[fpc-devel] JSON Beautifier

theo xpde at theo.ch
Wed Oct 13 11:19:51 CEST 2010


> Hm. This is a bug, I'll fix that. I didn't test arrays inside objects,
only
> objects inside arrays...

Thanks

> Can you provide me an example of how NetBeans formats
> a simple array [ 0, 1, 2 ]

It does nothing with these it seems. It leaves them as they were in the source code.
If they had line breaks after the Comma, it won't remove them. Not even empty lines.

> and a simple object { "x" : 1, "y": 2 }

Below are two examples formatted with Netbeans, your simple object and
the wiki example.

SimpleObj={
    "x" : 1,
    "y": 2
};

WikiExample={
    "Herausgeber": "Xema",
    "Nummer": "1234-5678-9012-3456",
    "Deckung": 2e+6,
    "Währung": "EURO",
    "Inhaber": {
        "Name": "Mustermann",
        "Vorname": "Max",
        "männlich": true,
        "Hobbys": [ "Reiten", "Golfen", "Lesen"],
        "Alter": 42
    }
};

It's not that I would say Netbeans is the reference, but what it does
looks quite readable to me.
Not sure if not-formatting simple arrays is a good idea though.

Thank you.




More information about the fpc-devel mailing list