Enhance the drawing of complex json objects

0 votes
asked May 30, 2025 in Wanted features by jens.fudickar (420 points)

Having a json object in a class diagram like this

@startuml
json "<b>JSON basic element" as J {

"JSON_Array" : [
  [],
  [true, false],
  [-1, 1],
  ["a", "b", "c"],
  ["mix", null, true, 1, {"k": "v"}],
  {"k": "v"},
  {"k": "v"},
   {
    "{}": {},
    "k_int": 123,
    "k_str": "abc",
    "k_obj": {"k": "v"}
    },
   {
    "{}": {},
    "k_int": 123,
    "k_str": "abc",
    "k_obj": {"k": "v"}
    }
]
}
@enduml

It is hard to understand which of the elements in the array are real lines, and which are record elements.

I would suggest if the element is an record and has more then one element add an small empty column before the elements of the record. This would make it much more readable.

commented Jun 1, 2025 by The-Lu (89,080 points)

Hallo J.,

Awaiting [internal] JSON Object enhancement...

From:

If you want you can also use sub-diagram in order to use JSON diagram instead [internal] JSON Object, like:

@startuml
class a

object "JSON basic element" {
{{json
{
"JSON_Array" : [
  [],
  [true, false],
  [-1, 1],
  ["a", "b", "c"],
  ["mix", null, true, 1, {"k": "v"}],
  {"k": "v"},
  {"k": "v"},
   {
    "{}": {},
    "k_int": 123,
    "k_str": "abc",
    "k_obj": {"k": "v"}
    },
   {
    "{}": {},
    "k_int": 123,
    "k_str": "abc",
    "k_obj": {"k": "v"}
    }
]
}
}}
}
@enduml

Enjoy,
Regards,
Th.

1 Answer

0 votes
answered Jun 1, 2025 by Jens Fudickar
This I know, but it's not the same.
I like the more compact view and would love to see this a little bit improved.

Regards

Jens
...