You are trying to build a structure from a string that should be JSON, but it is not: instead, it contains a Perl error message "Not a SCALAR reference...". The source of the problem is probably the code that generates the JSON string, not the code that tries to read it. | [reply] |
I ran into exactly the same problem (yes, on the server side) when I was trying to JSONify a structure which I forgot had a sub (that is, a code-reference) in it. When my code referred to that element of the underlying structure, then I know that Perl will conveniently call the subroutine for me and hand me back the value ... which is what I intended ... but JSON-encoding routines are a bit more literal in their world-view. I had to be very careful to prepare a data-structure for encoding purposes that contained nothing but values. Yup, it was an easy fix once I realized what was wrong, and, yup, I had pretty much the same “WTF?!” experience as you just did. (Followed rather immediately by, “Oh... well, duh...”)
| |
| [reply] |