commons.json - Java的序列化与反序列化JSON格式类库

openkk 13年前
     <p>commons.json 是Java的序列化与反序列化JSON格式的类库,commons.json非常轻量,且性能比Jackson和Gson好,并且支持缓存。</p>    <p>示例:</p>    <h4>Java Object to JSON:</h4>    <pre style="border-bottom:#dddddd 1px solid;border-left:#dddddd 1px solid;padding-bottom:5px;overflow-x:auto;overflow-y:auto;background-color:#eeeeee;margin:1em 0px;padding-left:5px;padding-right:5px;font:12px/1.5em Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;color:#444444;border-top:#dddddd 1px solid;border-right:#dddddd 1px solid;padding-top:5px;border-top-left-radius:3px 3px;border-top-right-radius:3px 3px;border-bottom-right-radius:3px 3px;border-bottom-left-radius:3px 3px;"><code style="border-bottom:1px;border-left:1px;padding-bottom:0px !important;background-color:#eeeeee !important;margin:0px;padding-left:0px !important;padding-right:0px !important;font:12px/1.4em Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;color:#444444 !important;border-top:1px;border-right:1px;padding-top:0px !important;none:;">String json = Json.serialize(object);</code></pre>    <h4 style="border-bottom:0px;border-left:0px;padding-bottom:0px;line-height:1.4em;margin:0px;padding-left:0px;padding-right:0px;border-top:0px;border-right:0px;padding-top:0px;initial:;">JSON to Java Object:</h4>    <pre style="border-bottom:#dddddd 1px solid;border-left:#dddddd 1px solid;padding-bottom:5px;overflow-x:auto;overflow-y:auto;background-color:#eeeeee;margin:1em 0px;padding-left:5px;padding-right:5px;font:12px/1.5em Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;color:#444444;border-top:#dddddd 1px solid;border-right:#dddddd 1px solid;padding-top:5px;border-top-left-radius:3px 3px;border-top-right-radius:3px 3px;border-bottom-right-radius:3px 3px;border-bottom-left-radius:3px 3px;"><code style="border-bottom:1px;border-left:1px;padding-bottom:0px !important;background-color:#eeeeee !important;margin:0px;padding-left:0px !important;padding-right:0px !important;font:12px/1.4em Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;color:#444444 !important;border-top:1px;border-right:1px;padding-top:0px !important;none:;">Object object = Json.deserialize(string);</code></pre>    <h4 style="border-bottom:0px;border-left:0px;padding-bottom:0px;line-height:1.4em;margin:0px;padding-left:0px;padding-right:0px;border-top:0px;border-right:0px;padding-top:0px;initial:;">Set CacheProvider</h4>    <pre style="border-bottom:#dddddd 1px solid;border-left:#dddddd 1px solid;padding-bottom:5px;overflow-x:auto;overflow-y:auto;background-color:#eeeeee;margin:1em 0px;padding-left:5px;padding-right:5px;font:12px/1.5em Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;color:#444444;border-top:#dddddd 1px solid;border-right:#dddddd 1px solid;padding-top:5px;border-top-left-radius:3px 3px;border-top-right-radius:3px 3px;border-bottom-right-radius:3px 3px;border-bottom-left-radius:3px 3px;"><code style="border-bottom:1px;border-left:1px;padding-bottom:0px !important;background-color:#eeeeee !important;margin:0px;padding-left:0px !important;padding-right:0px !important;font:12px/1.4em Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;color:#444444 !important;border-top:1px;border-right:1px;padding-top:0px !important;none:;">Json.setCacheProvider(new LinkedHashMapCacheProvider());    </code></pre>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1324214396390" target="_blank">http://www.open-open.com/lib/view/home/1324214396390</a></p>