This can also be done using the Ultimate Clarionizer part of the ClarionLive Ultimate Utilities on GitHub.
Clarionizer it is written in Clarion so easy for anyone here to change, e.g. add an option to encode quotes as <39>.
Here’s Mike’s example JSON:
The change I would make first is that TEXT control from Segoe 8 pt to Consolas 11 pt to be a fixed space font making the code easy to read. Here is the Clarionizer result pasted so easier to read:
'"items": [{{ <13,10>' & |
' "id": "11111111-2222-3333-4444-555555555555", <13,10>' & |
' "name": "Test name", <13,10>' & |
' "quantity": 999, <13,10>' & |
' "subItems": [{{ <13,10>' & |
' "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", <13,10>' & |
' "name": "subitem 1" <13,10>' & |
' }, {{ <13,10>' & |
' "id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy", <13,10>' & |
' "name": "subitem 2" <13,10>' & |
' }] <13,10>' & |
'}]'
Another change (and in my “String Builder”) would be an option to encode 13,10 as a ‘<13,10>’ in the output so the above example would output like below. I think MlsFmt has this as “Keep New lines”. I also append the “Length=304” to the end.
'"items": [{{' &|
'<13,10> "id": "11111111-2222-3333-4444-555555555555",' &|
'<13,10> "name": "Test name",' &|
'<13,10> "quantity": 999,' &|
'<13,10> "subItems": [{{' &|
'<13,10> "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",' &|
'<13,10> "name": "subitem 1"' &|
'<13,10> }, {{' &|
'<13,10> "id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",' &|
'<13,10> "name": "subitem 2"' &|
'<13,10> }]' &|
'<13,10>}]' ! Length = 304