Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Did the JSON module change?

by ikegami (Patriarch)
on Mar 01, 2018 at 19:24 UTC ( [id://1210179]=note: print w/replies, xml ) Need Help??


in reply to Did the JSON module change?

[Ignore/delete this post. I misunderstood the issue. The hash is still a red herring, but the rest doesn't apply. Differences in the choice of back-end could still be relevant, but it's not the only possibility. I don't have time to look deeper right now.]

The hash is a red herring. The results of mathematical operators are numbers, and the result of concatenation is a string. Period.

$ perl -MJSON -E' say encode_json({ a=>"7", b=>8, c=>"1"+"8", d=>1 . 0 }); ' {"a":"7","b":8,"c":9,"d":"10"}

You also asked about changes in behaviour. Keep in mind that JSON is a merely front for JSON::XS, but it defaults to using JSON::PP if JSON::XS is not available. That means its behaviour could theoretically change based on which modules you have installed.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2025-05-21 02:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.