Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: make duplicate JSON keys an error

by sundialsvc4 (Abbot)
on Oct 24, 2013 at 13:19 UTC ( #1059453=note: print w/replies, xml ) Need Help??

in reply to make duplicate JSON keys an error

Musing about this ... while it might be nice to be able to detect such an error in what the data-supplier gives us, it might also be necessary to anticipate the problem and compensate for it in some reasonable way ... i.e. associate an arrayref of values with the key, pushing values onto it in the order received.   If the supplier is using an Unenlightened Language that is doing the wrong thing, we just might have to find a way to live with it.   If we want to / have to, as we so often find that we must.

Our pragmatic situation just might be:   “I realize that the incoming data is incorrect.   I can’t do anything about it, because the supplier of these data is a Leviathan company that runs at a glacial pace, and I can’t wait two years for them to decide they won’t accept a trouble-ticket from us.   Meanwhile, I must not lose data, especially without knowing if or that I did.”

Over the years, I have dealt with a number of data-supplier situations where they “just switched to JSON,” often apparently writing their own code or template to do it, and they simply treated it “like XML/SOAP,” which does permit an arbitrary number of identically-named groups to appear in any container.   They just did it that way, and fixing their code is not on their radar and never will be.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1059453]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2018-06-20 18:10 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (117 votes). Check out past polls.