NAME
Template::Plugin::DeJSON - de-JSONify a JSON string
SYNOPSIS
[%
USE deJSON;
hash = deJSON.deJSON(json_string);
FOREACH field=hash;
field; field.value;
END;
%]
DESCRIPTION
Well, I needed this. I had JSON string things flying around between servers, and passed into templates. (If you must know, objects were stringified using JSON, and bit-shifted around the world.) It seemed to me I needed a plugin to take those strings and turn them into something a bit more useful.
So it takes a JSON string, and gives you back a hash. Or me. It gives it back to me. YMMV.
It also copes with JSON strings within JSON strings, returning a nice data structure where the values themselves might be hashes. This is good. It means keys don't get overwritten. Again, it works on my machine for what I want it to do. YMM(again)V.
BUGS
Yup.
It doesn't cope if you have curly braces in your strings. The next version will cope with that, honest.
I tried using Text::Balanced, but it didn't do what I wanted, so I rolled my own. Yes, I know there are better ways to do it, but I wrote it without access to the interwebs to find out how to better solve this solved problem. Leave me alone, alright?
AUTHOR
Stray Taoist <mwk@strayLALALAtoaster.co.uk>
COPYRIGHT
Copyright (c) 2007 StrayTaoist
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
STUFF
o things
THINGS
o stuff