Perl Json处理模块之JSON::XS
Perl环境下有较多的json处理模块,它多于web开发中的数据交换,个人还是喜欢json::xs,速度快(采用C语言开发),接口简单(同时对细节又有诸多接口),utf8支持等特点。JSON::XS - JSON serialising/deserialising, done correctly and fast
This module converts Perl data structures to JSON and vice versa. Its primary goal is to be correct and its secondary goal is to be fast. To reach the latter goal it was written in C.
Features
correct Unicode handling
This module knows how to handle Unicode, documents how and when it does so, and even documents what "correct" means.
round-trip integrity
When you serialise a perl data structure using only data types supported by JSON and Perl, the deserialised data structure is identical on the Perl level. (e.g. the string "2.0" doesn't suddenly become "2" just because it looks like a number).
strict checking of JSON correctness
There is no guessing, no generating of illegal JSON texts by default, and only JSON is accepted as input by default (the latter is a security feature).
fast
Compared to other JSON modules and other serialisers such as Storable, this module usually compares favourably in terms of speed, too.
simple to use
This module has both a simple functional interface as well as an object oriented interface.
reasonably versatile output formats
You can choose between the most compact guaranteed-single-line format possible (nice for simple line-based protocols), a pure-ASCII format (for when your transport is not 8-bit clean, still supports the whole Unicode range), or a pretty-printed format (for when you want to read that stuff). Or you can combine those features in whatever way you like.
最新版本:3.0
项目主页:https://metacpan.org/pod/JSON::XS