Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: make duplicate JSON keys an error

by sundialsvc4 (Monsignor)
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.


Comment on Re: make duplicate JSON keys an error

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1059453]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-08-02 10:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (55 votes), past polls