ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/JSON-XS/README
(Generate patch)

Comparing JSON-XS/README (file contents):
Revision 1.30 by root, Mon Jul 13 22:13:17 2009 UTC vs.
Revision 1.33 by root, Tue Jan 19 00:31:13 2010 UTC

377 it is disabled, the same hash might be encoded differently even if 377 it is disabled, the same hash might be encoded differently even if
378 contains the same data, as key-value pairs have no inherent ordering 378 contains the same data, as key-value pairs have no inherent ordering
379 in Perl. 379 in Perl.
380 380
381 This setting has no effect when decoding JSON texts. 381 This setting has no effect when decoding JSON texts.
382
383 This setting has currently no effect on tied hashes.
382 384
383 $json = $json->allow_nonref ([$enable]) 385 $json = $json->allow_nonref ([$enable])
384 $enabled = $json->get_allow_nonref 386 $enabled = $json->get_allow_nonref
385 If $enable is true (or missing), then the "encode" method can 387 If $enable is true (or missing), then the "encode" method can
386 convert a non-reference into its corresponding string, number or 388 convert a non-reference into its corresponding string, number or
1151 my $yaml = $to_yaml->encode ($ref) . "\n"; 1153 my $yaml = $to_yaml->encode ($ref) . "\n";
1152 1154
1153 This will *usually* generate JSON texts that also parse as valid YAML. 1155 This will *usually* generate JSON texts that also parse as valid YAML.
1154 Please note that YAML has hardcoded limits on (simple) object key 1156 Please note that YAML has hardcoded limits on (simple) object key
1155 lengths that JSON doesn't have and also has different and incompatible 1157 lengths that JSON doesn't have and also has different and incompatible
1156 unicode handling, so you should make sure that your hash keys are 1158 unicode character escape syntax, so you should make sure that your hash
1157 noticeably shorter than the 1024 "stream characters" YAML allows and 1159 keys are noticeably shorter than the 1024 "stream characters" YAML
1158 that you do not have characters with codepoint values outside the 1160 allows and that you do not have characters with codepoint values outside
1159 Unicode BMP (basic multilingual page). YAML also does not allow "\/" 1161 the Unicode BMP (basic multilingual page). YAML also does not allow "\/"
1160 sequences in strings (which JSON::XS does not *currently* generate, but 1162 sequences in strings (which JSON::XS does not *currently* generate, but
1161 other JSON generators might). 1163 other JSON generators might).
1162 1164
1163 There might be other incompatibilities that I am not aware of (or the 1165 There might be other incompatibilities that I am not aware of (or the
1164 YAML specification has been changed yet again - it does so quite often). 1166 YAML specification has been changed yet again - it does so quite often).
1180 of its proponents, I would kindly suggest reading the JSON spec 1182 of its proponents, I would kindly suggest reading the JSON spec
1181 (which is not that difficult or long) and finally make YAML 1183 (which is not that difficult or long) and finally make YAML
1182 compatible to it, and educating users about the changes, instead of 1184 compatible to it, and educating users about the changes, instead of
1183 spreading lies about the real compatibility for many *years* and 1185 spreading lies about the real compatibility for many *years* and
1184 trying to silence people who point out that it isn't true. 1186 trying to silence people who point out that it isn't true.
1187
1188 Addendum/2009: the YAML 1.2 spec is still incomaptible with JSON,
1189 even though the incompatibilities have been documented (and are
1190 known to Brian) for many years and the spec makes explicit claims
1191 that YAML is a superset of JSON. It would be so easy to fix, but
1192 apparently, bullying and corrupting userdata is so much easier.
1185 1193
1186 SPEED 1194 SPEED
1187 It seems that JSON::XS is surprisingly fast, as shown in the following 1195 It seems that JSON::XS is surprisingly fast, as shown in the following
1188 tables. They have been generated with the help of the "eg/bench" program 1196 tables. They have been generated with the help of the "eg/bench" program
1189 in the JSON::XS distribution, to make it easy to compare on your own 1197 in the JSON::XS distribution, to make it easy to compare on your own
1280 information you might want to make sure that exceptions thrown by 1288 information you might want to make sure that exceptions thrown by
1281 JSON::XS will not end up in front of untrusted eyes. 1289 JSON::XS will not end up in front of untrusted eyes.
1282 1290
1283 If you are using JSON::XS to return packets to consumption by JavaScript 1291 If you are using JSON::XS to return packets to consumption by JavaScript
1284 scripts in a browser you should have a look at 1292 scripts in a browser you should have a look at
1285 <http://jpsykes.com/47/practical-csrf-and-json-security> to see whether 1293 <http://blog.archive.jpsykes.com/47/practical-csrf-and-json-security/>
1286 you are vulnerable to some common attack vectors (which really are 1294 to see whether you are vulnerable to some common attack vectors (which
1287 browser design bugs, but it is still you who will have to deal with it, 1295 really are browser design bugs, but it is still you who will have to
1288 as major browser developers care only for features, not about getting 1296 deal with it, as major browser developers care only for features, not
1289 security right). 1297 about getting security right).
1290 1298
1291THREADS 1299THREADS
1292 This module is *not* guaranteed to be thread safe and there are no plans 1300 This module is *not* guaranteed to be thread safe and there are no plans
1293 to change this until Perl gets thread support (as opposed to the 1301 to change this until Perl gets thread support (as opposed to the
1294 horribly slow so-called "threads" which are simply slow and bloated 1302 horribly slow so-called "threads" which are simply slow and bloated

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines