AykutSarac / jsoncrack.com

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML, CSV and more, into interactive graphs.
https://jsoncrack.com/
Other
33.5k stars 2.15k forks source link

[BUG]: object member and array of one object member have same visual results #140

Closed levalup closed 1 year ago

levalup commented 2 years ago

Issue description

Using JSON:

{
  "A": {
    "A": true
  },
  "B": [
    {
      "A": true
    }
  ]
}

at https://jsoncrack.com/editor

gives:

image

As A and B are different at all.

Media & Screenshots

No response

Operating system

Priority this issue should have

Low (slightly annoying)

AykutSarac commented 2 years ago

I'm open for suggestions.

levalup commented 2 years ago

May add symbol [] and {} to tell which type it is. like:

188413040-fc33c890-67eb-4b99-926e-7d7a96a84c3e
jonasmateus commented 2 years ago

I´ve been testing the code and I don´t know how to do that yet. Cause I have to check each key of json for check if it´s an array or object, doing this I put string square or curly brackets. The square element <TextNode/> receives a property called text representing the displayed content.

victorbrambati commented 2 years ago

@jonasmateus Now with the new parser algorithm in PR #251 you can have the type of node, in addNodes() you can create a object in data called type.