@startuml !$myjson = { "root" : [{ "fruits": [ { "name": "apple", "colorId": "1" }, { "name": "pear", "colorId": "2" }, { "name": "pineapple", "colorId": "3" } ] }, { "colors": [ { "id": "1", "name": "red" }, { "id": "2", "name": "green" }, { "id": "3", "name": "yellow" } ] }] } set namespaceSeparator none !$i = 1 !procedure $debug($text1, $text2) object %string($i + "_" + $text1) { %string($text2) %size($text2) } !$i = $i +1 !endprocedure !procedure process_json($stem, $json) !if %substr($json,0,1) != "{" map %string($stem) { } !endif !if %substr($json,0,1) == "[" '!if $i > 1 ' $debug("square", $json) '!endif !$j=0 !foreach $node in $json '$debug("element", $node) process_json(%string($stem+"."+$j), $node) $stem --> %string($stem+"."+$j) !$j=$j+1 !endfor !elseif %substr($json,0,1) == "{" '$debug("curly", $json) ' parse for map map $stem { !$rest=$json !while $rest != "{" !$key = %substr($rest,2,%strpos($rest, ":")-3) !$value = $json[$key] !if %substr($value,0,1) != "[" $key => $value !endif !$rest = "{" + %substr($rest,%strlen("{"+%chr(34)+$key+%chr(34)+":"+%chr(34)+$json[$key]+%chr(34)+"}")) !endwhile } ' parse again for recursions !$rest=$json !while $rest != "{" !$key = %substr($rest,2,%strpos($rest, ":")-3) !$value = $json[$key] !if %substr($value,0,1) == "[" '$debug("key", $key) '$debug("value", $value) process_json(%string($stem+"."+$key), $value) $stem --> %string($stem+"."+$key) !endif !$rest = "{" + %substr($rest,%strlen("{"+%chr(34)+$key+%chr(34)+":"+%chr(34)+$value+%chr(34)+"}")) '$debug("rest", $rest) !endwhile !else '$debug("string", $json) !endif !endprocedure process_json("root", $myjson.root) root.0.fruits.0::apple -> root.1.colors.0::red @enduml
Decode URL
Submit
amiga
aws-orange
black-knight
bluegray
blueprint
cerulean-outline
cerulean
crt-amber
crt-green
cyborg-outline
cyborg
hacker
lightgray
mars
materia-outline
materia
metal
mimeograph
minty
plain
reddress-darkblue
reddress-darkgreen
reddress-darkorange
reddress-darkred
reddress-lightblue
reddress-lightgreen
reddress-lightorange
reddress-lightred
sandstone
silver
sketchy-outline
sketchy
spacelab
spacelab-white
superhero-outline
superhero
toy
united
vibrant
Pure Javascript
PNG
SVG
ASCII Art