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

Re: Did the JSON module change?

by ikegami (Pope)
on Mar 01, 2018 at 19:24 UTC ( #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
Node Status?
node history
Node Type: note [id://1210179]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2020-02-22 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (98 votes). Check out past polls.

    Notices?