qiuquanwu / vue3-json-viewer

Simple JSON viewer component, for Vue.js 3.x
https://vjv-doc-qiuquanwu.vercel.app/
MIT License
103 stars 15 forks source link

How to parse strings into string JSON #22

Open seungdeok opened 4 months ago

seungdeok commented 4 months ago

I am using this library. when I used value used json.stringfy, I convert easy json value. exmaple) parse option.

<template>
  <JsonViewer :value="jsonData" copyable boxed sort theme="light"  @onKeyClick="keyClick"/>
  <!-- example parse -->
  <JsonViewer parse :value="jsonStringData" copyable boxed sort theme="dark"  @onKeyClick="keyClick"/>
</template>

<script setup>
  let obj = {
    name: "qiu",//string
    age: 18,//Array
    isMan:false,//boolean
    date:new Date(),
    fn:()=>{},
    arr:[1,2,5],
    reg:/ab+c/i
  };
  const jsonData = reactive(obj);
  const jsonStringData = reactive(obj);
</script>

I want to equal jsonData and jsonStringData.

if you have no plan yet but need, maybe I can contribute?

qiuquanwu commented 4 months ago

I am using this library. when I used value used json.stringfy, I convert easy json value. exmaple) parse option.

<template>
  <JsonViewer :value="jsonData" copyable boxed sort theme="light"  @onKeyClick="keyClick"/>
  <!-- example parse -->
  <JsonViewer parse :value="jsonStringData" copyable boxed sort theme="dark"  @onKeyClick="keyClick"/>
</template>

<script setup>
  let obj = {
    name: "qiu",//string
    age: 18,//Array
    isMan:false,//boolean
    date:new Date(),
    fn:()=>{},
    arr:[1,2,5],
    reg:/ab+c/i
  };
  const jsonData = reactive(obj);
  const jsonStringData = reactive(obj);
</script>

I want to equal jsonData and jsonStringData.

if you have no plan yet but need, maybe I can contribute?

I think your idea is good, you can contribute