JKISoftware / JKI-JSON-Serialization

JSON Serialization & Deserialization Library for LabVIEW
http://jki.net/tools#json
BSD 3-Clause "New" or "Revised" License
25 stars 9 forks source link

Incorrect parsing of empty strings as object member names #27

Open JKSH opened 7 years ago

JKSH commented 7 years ago

Version 1.1.10.37

For fun, I unflattened the convoluted document from my comment in #26:

{
    "": {
        "": [
            {
                "": "",
                "txDefinition": {
                    "repeatRate": 0,
                    "canPort": 0,
                    "messageId": 0
                }
            }
        ]
    }
}

When I re-flatten this again, I get:

[
        [
        [
                        [
                "",
                {
                    "repeatRate":0,
                    "canPort":0,
                    "messageId":0
                }
            ]
        ]
    ]
]

Objects have been transformed into arrays.

Also, notice the weird indentation of the innermost and 2nd-innermost arrays at the output.


The output is correct if I replace the empty names ("") with non-empty ones.

See https://stackoverflow.com/questions/33254385/can-a-json-name-value-pair-have-an-empty-name -- Empty strings are valid names for object members.

jimkring commented 7 years ago

@JKSH For what it's worth, I think we've resolved the "weird indentation" issue #31