From: Karen Etheridge Date: Sat, 25 Jul 2015 01:45:58 +0000 (-0700) Subject: add a quick reference for converting from JSON::Any X-Git-Tag: v1.003006_001~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=61f129a56f7931af964b1a80c1fb703aab29110e;p=p5sagit%2FJSON-MaybeXS.git add a quick reference for converting from JSON::Any --- diff --git a/lib/JSON/MaybeXS.pm b/lib/JSON/MaybeXS.pm index e3fa12c..a521d3f 100644 --- a/lib/JSON/MaybeXS.pm +++ b/lib/JSON/MaybeXS.pm @@ -223,6 +223,33 @@ To include JSON-aware booleans (C, C) in your data, just do: my $true = JSON->true; my $false = JSON->false; +=head1 CONVERTING FROM JSON::Any + +L used to be the favoured compatibility layer above the various +JSON backends, but over time has grown a lot of extra code to deal with legacy +backends (e.g. L) that are no longer needed. This is a rough guide of translating such code: + +Change code from: + + use JSON::Any; + my $json = JSON::Any->new->objToJson($data); # or to_json($data), or Dump($data) + +to: + + use JSON::MaybeXS; + my $json = encode_json($data); + + +Change code from: + + use JSON::Any; + my $data = JSON::Any->new->jsonToObj($json); # or from_json($json), or Load($json) + +to: + + use JSON::MaybeXS; + my $json = decode_json($data); + =head1 CAVEATS The C method in this module is technically a factory, not a