I have a serialized JSON String (chef role definition actually) and it has a json_class key, making the ruby JSON parser try to force it to be a Chef::Role object. How can I make the parser ignore this key and just simply deserialize into a normal Hash?
Share
I just had the same problem, and found the answer by reading the source of the JSON gem – just unset JSON.create_id before trying to do the parse:
EDIT: Note that since version 1.7 of the gem (1.8.0 is current as I type this update), the above hack is no longer necessary.
JSON#parsenow ignoresjson_class, andJSON#loadshould be used instead for unmarshalling dumped objects.