You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2016/10/16 20:55:07 UTC
incubator-juneau-website git commit: More serialization examples.
Repository: incubator-juneau-website
Updated Branches:
refs/heads/asf-site 1fa426b7a -> 242acccbd
More serialization examples.
Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/commit/242acccb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/tree/242acccb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/diff/242acccb
Branch: refs/heads/asf-site
Commit: 242acccbd49f8d737e784d7a3e6794633b253723
Parents: 1fa426b
Author: JamesBognar <ja...@apache.org>
Authored: Sun Oct 16 16:55:04 2016 -0400
Committer: JamesBognar <ja...@apache.org>
Committed: Sun Oct 16 16:55:04 2016 -0400
----------------------------------------------------------------------
content/about.html | 43 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 41 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/242acccb/content/about.html
----------------------------------------------------------------------
diff --git a/content/about.html b/content/about.html
index 75de2eb..21a6229 100644
--- a/content/about.html
+++ b/content/about.html
@@ -36,6 +36,10 @@
<jc>// Produces:
// "{name:'John Smith',age:21}"</jc>
+ String json = JsonSerializer.<jsf>DEFAULT_LAX</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // "{"name":"John Smith","age":21}"</jc>
String json = JsonSerializer.<jsf>DEFAULT</jsf>.serialize(p);
<jc>// Produces:
@@ -43,15 +47,50 @@
// <name>John Smith</name>
// <age>21</age>
// </object><</jc>
- String xml = XmlSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+ String xml = XmlSerializer.<jsf>DEFAULT_SIMPLE</jsf>.serialize(p);
<jc>// Produces:
// <table>
- // <tr><th>key</th><th>value</th></tr>
// <tr><td>name</td><td>John Smith</td></tr>
// <tr><td>age</td><td>21</td></tr>
// </table></jc>
String html = HtmlSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // name=John+Smith&age=$n(21)</jc>
+ String urlEncoding = UrlEncodingSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // $o(name=John Smith,age=$n(21))</jc>
+ String uon = UonSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // 82 A4 name AA 4A John Smith 68 A3 age 15</jc>
+ <jk>byte</jk>[] messagePack = MsgPackSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // <rdf:RDF
+ // xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ // xmlns:jp="http://www.ibm.com/juneaubp/"
+ // xmlns:j="http://www.ibm.com/juneau/">
+ // <rdf:Description>
+ // <jp:name>John Smith</jp:name>
+ // <jp:age>21</jp:age>
+ // </rdf:Description>
+ // </rdf:RDF></jc>
+ String rdfXml = RdfSerializer.<jsf>DEFAULT_XMLABBREV</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // @prefix jp: <http://www.ibm.com/juneaubp/> .
+ // @prefix j: <http://www.ibm.com/juneau/> .
+ // [] jp:age "21" ;
+ // jp:name "John Smith" .</jc>
+ String rdfN3 = RdfSerializer.<jsf>DEFAULT_N3</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // _:A3bf53c85X3aX157cf407e2dX3aXX2dX7ffd <http://www.ibm.com/juneaubp/name> "John Smith" .
+ // _:A3bf53c85X3aX157cf407e2dX3aXX2dX7ffd <http://www.ibm.com/juneaubp/age> "21" .</jc>
+ String rdfNTriple = RdfSerializer.<jsf>DEFAULT_NTRIPLE</jsf>.serialize(p);
</p>
<p>
Parsing back into POJOs is equally simple...