← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/feature-jsonml_object into lp:zorba

 

Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/feature-jsonml_object into lp:zorba.

Commit message:
Added support for the JsonML "object form" (even though there is no such thing).

Requested reviews:
  Paul J. Lucas (paul-lucas)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/feature-jsonml_object/+merge/198858

Added support for the JsonML "object form" (even though there is no such thing).
-- 
https://code.launchpad.net/~zorba-coders/zorba/feature-jsonml_object/+merge/198858
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h	2013-10-15 23:27:57 +0000
+++ include/zorba/pregenerated/diagnostic_list.h	2013-12-13 02:13:02 +0000
@@ -879,6 +879,8 @@
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZJ2X0001_JSONML_ARRAY_BAD_JSON;
 
+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZJ2X0002_JSONML_OBJECT_BAD_JSON;
+
 } // namespace zerr
 
 namespace jerr {

=== modified file 'modules/json/CMakeLists.txt'
--- modules/json/CMakeLists.txt	2013-08-28 04:15:48 +0000
+++ modules/json/CMakeLists.txt	2013-12-13 02:13:02 +0000
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-DECLARE_ZORBA_MODULE(FILE json-xml.xq VERSION 1.0
+DECLARE_ZORBA_MODULE(FILE json-xml.xq VERSION 1.1
   URI "http://zorba.io/modules/json-xml";)
 
 DECLARE_ZORBA_MODULE(FILE json-csv.jq VERSION 1.0

=== modified file 'modules/json/json-xml.xq'
--- modules/json/json-xml.xq	2013-09-26 23:15:11 +0000
+++ modules/json/json-xml.xq	2013-12-13 02:13:02 +0000
@@ -41,7 +41,7 @@
  :     "phoneNumbers" : [ "212 732-1234", "646 123-4567" ]
  :   }
  : </pre>
- : would be represented as:
+ : would be represented in XML as:
  : <pre class="ace-static" ace-mode="xquery">
  :   &lt;json type="object"&gt;
  :     &lt;pair name="firstName" type="string"&gt;John&lt;/pair&gt;
@@ -76,7 +76,7 @@
  :     ]
  :   ]
  : </pre>
- : would be represented as:
+ : would be represented in XML as:
  : <pre class="ace-static" ace-mode="xquery">
  :   &lt;person created="2006-11-11T19:23" modified="2006-12-31T23:59"&gt;
  :     &lt;firstName&gt;Robert&lt;/firstName&gt;
@@ -89,6 +89,29 @@
  :     &lt;/address&gt;
  :   &lt;/person&gt;
  : </pre>
+ : This module also implements the "object form" of JsonML
+ : (<a href="http://www.jsonml.org/syntax/";>even though there is no "object form" of JsonML</a>).
+ : For example:
+ : <pre class="ace-static" ace-mode="java">
+ :  {
+ :    "tagName" : "person",
+ :    "created" : "2006-11-11T19:23",
+ :    "modified" : "2006-12-31T23:59",
+ :    "childNodes" : [
+ :      { "tagName" : "firstName", "childNodes" : [ "Robert" ] },
+ :      { "tagName" : "lastName", "childNodes" : [ "Smith" ] },
+ :      { "tagName" : "address",
+ :        "type" : home",
+ :        "childNodes" : [
+ :          { "tagName" : "street", "childNodes" : [ "12345 Sixth Ave" ] },
+ :          { "tagName" : "city", "childNodes" : [ "Anytown" ] },
+ :          { "tagName" : "state", "childNodes" : [ "CA" ] },
+ :          { "tagName" : "postalCode", "childNodes" : [ "98765-4321" ] }
+ :        ]
+ :      }
+ :    ]
+ :  }
+ : </pre>
  :
  : @author Paul J. Lucas
  : @project Zorba/Data Converters/JSON
@@ -99,21 +122,35 @@
 declare namespace zerr = "http://zorba.io/errors";;
 
 declare namespace ver = "http://zorba.io/options/versioning";;
-declare option ver:module-version "1.0";
+declare option ver:module-version "1.1";
 
 (:~
  : Converts JSON data into an XDM instance using one of the representations
- : described above.<p/>
+ : described above.
  :
  : @param $json The JSON data.
- : @param $options The JSON conversion  options, for example:
- : <pre>
- : { "json-format" : "JsonML-array" }
- : </pre>
+ : @param $options The options to use:
+ :  <dl>
+ :    <dt><code>json-format</code></dt>
+ :      <dd>
+ :        Specifies the format that <code>$json</code> is in; one of:
+ :        <code>JsonML-array</code>,
+ :        <code>JsonML-object</code>,
+ :        or
+ :        <code>Snelson</code>.
+ :        Additionally,
+ :        <code>JsonML</code> is a synonym for <code>JsonML-array</code>.
+ :        default: <code>Snelson</code>.
+ :      </dd>
+ :  </dl>
  : @return said XDM instance.
+ : @error zerr:ZJSE0001 if <code>$json</code> is not an element node.
+ : @error zerr:ZJ2X0001 if <code>$json</code> is invalid JsonML (array form).
+ : @error zerr:ZJ2X0002 if <code>$json</code> is invalid JsonML (object form).
  : @example test/rbkt/Queries/zorba/json/json-snelson-j2x-array-01.xq
  : @example test/rbkt/Queries/zorba/json/json-snelson-j2x-object-01.xq
  : @example test/rbkt/Queries/zorba/json/json-jmla-j2x-01.xq
+ : @example test/rbkt/Queries/zorba/json/json-jmlo-j2x-01.xq
  :)
 declare function jx:json-to-xml( $json as json-item()?, $options as object() )
   as element(*,xs:untyped)?
@@ -123,10 +160,13 @@
 
 (:~
  : Converts JSON data into an XDM instance using the Snelson representation
- : described above.<p/>
+ : described above.
  :
  : @param $json The JSON data.
  : @return said XDM instance.
+ : @error zerr:ZJSE0001 if <code>$json</code> is not an element node.
+ : @error zerr:ZJ2X0001 if <code>$json</code> is invalid JsonML (array form).
+ : @error zerr:ZJ2X0002 if <code>$json</code> is invalid JsonML (object form).
  : @example test/rbkt/Queries/zorba/json/json-snelson-j2x-array-01.xq
  : @example test/rbkt/Queries/zorba/json/json-snelson-j2x-object-01.xq
  : @example test/rbkt/Queries/zorba/json/json-jmla-j2x-01.xq
@@ -139,23 +179,36 @@
 
 (:~
  : Converts XML data into a JSON item using one of the respresentations
- : described above.<p/>
+ : described above.
  :
  : @param $xml The XML data to convert.
- : @param $options The conversion options, for example:
- : <pre>
- : { "json-format" : "JsonML-array" }
- : </pre>
+ : @param $options The options to use:
+ :  <dl>
+ :    <dt><code>json-format</code></dt>
+ :      <dd>
+ :        Specifies the format that <code>$xml</code> is to be converted into;
+ :        one of:
+ :        <code>JsonML-array</code>,
+ :        <code>JsonML-object</code>,
+ :        or
+ :        <code>Snelson</code>.
+ :        Additionally,
+ :        <code>JsonML</code> is a synonym for <code>JsonML-array</code>.
+ :        default: <code>JsonML-array</code>.
+ :      </dd>
+ :  </dl>
  : @return said JSON items.
- : @error zerr:ZJSE0001 if $xml is not a document or element node.
- : @error zerr:ZJSE0002 if $xml contains an element that is missing a required
- : attribute.
- : @error zerr:ZJSE0003 if $xml contains an attribute having an illegal value.
- : @error zerr:ZJSE0004 if $xml contains an illegal element.
+ : @error zerr:ZJSE0001 if <code>$xml</code> is not a document or element node.
+ : @error zerr:ZJSE0002 if <code>$xml</code> contains an element that is
+ : missing a required attribute.
+ : @error zerr:ZJSE0003 if <code>$xml</code> contains an attribute having an
+ : illegal value.
+ : @error zerr:ZJSE0004 if <code>$xml</code> contains an illegal element.
  : type.
- : @error zerr:ZJSE0007 if $xml contains an element that is missing a required
- : value.
- : @error zerr:ZJSE0008 if $xml contains an illegal value for a JSON type.
+ : @error zerr:ZJSE0007 if <code>$xml</code> contains an element that is
+ : missing a required value.
+ : @error zerr:ZJSE0008 if <code>$xml</code> contains an illegal value for a
+ : JSON type.
  : @example test/rbkt/Queries/zorba/json/json-snelson-x2j-array-01.xq
  : @example test/rbkt/Queries/zorba/json/json-snelson-x2j-object-01.xq
  : @example test/rbkt/Queries/zorba/json/json-jmla-x2j-01.xq
@@ -168,22 +221,25 @@
 
 (:~
  : Converts XML data into a JSON item using the Snelson representation
- : described above.<p/>
+ : described above.
  :
  : @param $xml The XML data to convert.
  : @return said JSON items.
- : @error zerr:ZJSE0001 if $xml is not a document or element node.
- : @error zerr:ZJSE0002 if $xml contains an element that is missing a required
- : attribute.
- : @error zerr:ZJSE0003 if $xml contains an attribute having an illegal value.
- : @error zerr:ZJSE0004 if $xml contains an illegal element.
+ : @error zerr:ZJSE0001 if <code>$xml</code> is not a document or element node.
+ : @error zerr:ZJSE0002 if <code>$xml</code> contains an element that is
+ : missing a required attribute.
+ : @error zerr:ZJSE0003 if <code>$xml</code> contains an attribute having an
+ : illegal value.
+ : @error zerr:ZJSE0004 if <code>$xml</code> contains an illegal element.
  : type.
- : @error zerr:ZJSE0007 if $xml contains an element that is missing a required
- : value.
- : @error zerr:ZJSE0008 if $xml contains an illegal value for a JSON type.
+ : @error zerr:ZJSE0007 if <code>$xml</code> contains an element that is
+ : missing a required value.
+ : @error zerr:ZJSE0008 if <code>$xml</code> contains an illegal value for a
+ : JSON type.
  : @example test/rbkt/Queries/zorba/json/json-snelson-x2j-array-01.xq
  : @example test/rbkt/Queries/zorba/json/json-snelson-x2j-object-01.xq
  : @example test/rbkt/Queries/zorba/json/json-jmla-x2j-01.xq
+ : @example test/rbkt/Queries/zorba/json/json-jmlo-x2j-01.xq
  :)
 declare function jx:xml-to-json( $xml as item()* )
   as json-item()*

=== modified file 'modules/pregenerated/zorba-errors.xq'
--- modules/pregenerated/zorba-errors.xq	2013-10-15 23:27:57 +0000
+++ modules/pregenerated/zorba-errors.xq	2013-12-13 02:13:02 +0000
@@ -970,4 +970,8 @@
 
 (:~
 :)
-declare variable $zerr:ZJ2X0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZJ2X0001");
\ No newline at end of file
+declare variable $zerr:ZJ2X0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZJ2X0001");
+
+(:~
+:)
+declare variable $zerr:ZJ2X0002 as xs:QName := fn:QName($zerr:NS, "zerr:ZJ2X0002");
\ No newline at end of file

=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2013-10-16 21:47:22 +0000
+++ src/diagnostics/diagnostic_en.xml	2013-12-13 02:13:02 +0000
@@ -3275,6 +3275,22 @@
       </entry>
     </diagnostic>
 
+    <diagnostic code="ZJ2X0002" name="JSONML_OBJECT_BAD_JSON">
+      <value>JsonML (object form) $1</value>
+      <entry key="childNodesArrayRequired">
+        <value>"childNodes" key must have array value</value>
+      </entry>
+      <entry key="ObjectRequired">
+        <value>must start with object</value>
+      </entry>
+      <entry key="BadElement">
+        <value>array must not have a "$2" element</value>
+      </entry>
+      <entry key="tagNameRequired">
+        <value>must contain a "tagName" key</value>
+      </entry>
+    </diagnostic>
+
   </namespace>
 
   <namespace prefix="jerr">

=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp	2013-10-15 23:27:57 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp	2013-12-13 02:13:02 +0000
@@ -1298,6 +1298,9 @@
 ZorbaErrorCode ZJ2X0001_JSONML_ARRAY_BAD_JSON( "ZJ2X0001" );
 
 
+ZorbaErrorCode ZJ2X0002_JSONML_OBJECT_BAD_JSON( "ZJ2X0002" );
+
+
 } // namespace zerr
 
 namespace jerr {

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2013-10-16 22:17:33 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2013-12-13 02:13:02 +0000
@@ -409,6 +409,7 @@
   { "ZGDB0001", "" },
 #endif
   { "ZJ2X0001", "JsonML (array form) $1" },
+  { "ZJ2X0002", "JsonML (object form) $1" },
   { "ZJPE0001", "'$1': illegal JSON character" },
   { "ZJPE0002", "\"$1\": illegal Unicode code-point" },
   { "ZJPE0003", "'\\\\$1': illegal JSON character escape" },
@@ -997,6 +998,10 @@
   { "~ZJ2X0001_BadElement", "array must not have a \"$2\" element" },
   { "~ZJ2X0001_EmptyArray", "array must not be empty" },
   { "~ZJ2X0001_UnexpectedObject", "allows an object only for the 2nd element" },
+  { "~ZJ2X0002_BadElement", "array must not have a \"$2\" element" },
+  { "~ZJ2X0002_ObjectRequired", "must start with object" },
+  { "~ZJ2X0002_childNodesArrayRequired", "\"childNodes\" key must have array value" },
+  { "~ZJ2X0002_tagNameRequired", "must contain a \"tagName\" key" },
   { "~ZSTR0060_ForCollection_3", "for collection \"$3\"" },
   { "~ZSTR0060_ForSequence", "for sequence" },
   { "~ZWST0005_PARAM_TYPE", "type of parameter $3 is $4 which is not a subtype of xs:anyAtomicType" },

=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
--- src/diagnostics/pregenerated/dict_zed_keys.h	2013-09-19 23:43:00 +0000
+++ src/diagnostics/pregenerated/dict_zed_keys.h	2013-12-13 02:13:02 +0000
@@ -173,6 +173,10 @@
 #define ZED_ZJ2X0001_Bad1stElement "~ZJ2X0001_Bad1stElement"
 #define ZED_ZJ2X0001_BadElement "~ZJ2X0001_BadElement"
 #define ZED_ZJ2X0001_UnexpectedObject "~ZJ2X0001_UnexpectedObject"
+#define ZED_ZJ2X0002_childNodesArrayRequired "~ZJ2X0002_childNodesArrayRequired"
+#define ZED_ZJ2X0002_ObjectRequired "~ZJ2X0002_ObjectRequired"
+#define ZED_ZJ2X0002_BadElement "~ZJ2X0002_BadElement"
+#define ZED_ZJ2X0002_tagNameRequired "~ZJ2X0002_tagNameRequired"
 #define ZED_JNUP0007_Object "~JNUP0007_Object"
 #define ZED_JNUP0007_Array "~JNUP0007_Array"
 #define ZED_JNUP0007_ObjectArray "~JNUP0007_ObjectArray"

=== modified file 'src/runtime/CMakeLists.txt'
--- src/runtime/CMakeLists.txt	2013-10-01 22:39:42 +0000
+++ src/runtime/CMakeLists.txt	2013-12-13 02:13:02 +0000
@@ -130,6 +130,7 @@
   indexing/index_ddl.cpp
   json/common.cpp
   json/jsonml_array.cpp
+  json/jsonml_object.cpp
   json/snelson.cpp
   numerics/NumericsImpl.cpp
   numerics/format_integer.cpp

=== modified file 'src/runtime/json/common.cpp'
--- src/runtime/json/common.cpp	2013-07-24 23:15:02 +0000
+++ src/runtime/json/common.cpp	2013-12-13 02:13:02 +0000
@@ -17,7 +17,9 @@
 
 #include <zorba/xquery_exception.h>
 
+#include "store/api/item_factory.h"
 #include "store/api/iterator.h"
+#include "system/globalenv.h"
 
 #include "common.h"
 
@@ -44,6 +46,48 @@
   return found;
 }
 
+bool x2j_map_atomic( store::Item_t const &xml_item, store::Item_t *json_item ) {
+  if ( xml_item->isAtomic() ) {
+    switch ( xml_item->getTypeCode() ) {
+      case store::JS_NULL:
+      case store::XS_BOOLEAN:
+      case store::XS_BYTE:
+      case store::XS_DECIMAL:
+      case store::XS_DOUBLE:
+      case store::XS_ENTITY:
+      case store::XS_FLOAT:
+      case store::XS_ID:
+      case store::XS_IDREF:
+      case store::XS_INT:
+      case store::XS_INTEGER:
+      case store::XS_LONG:
+      case store::XS_NAME:
+      case store::XS_NCNAME:
+      case store::XS_NEGATIVE_INTEGER:
+      case store::XS_NMTOKEN:
+      case store::XS_NON_NEGATIVE_INTEGER:
+      case store::XS_NON_POSITIVE_INTEGER:
+      case store::XS_NORMALIZED_STRING:
+      case store::XS_POSITIVE_INTEGER:
+      case store::XS_SHORT:
+      case store::XS_STRING:
+      case store::XS_TOKEN:
+      case store::XS_UNSIGNED_BYTE:
+      case store::XS_UNSIGNED_INT:
+      case store::XS_UNSIGNED_LONG:
+      case store::XS_UNSIGNED_SHORT:
+        *json_item = xml_item;
+        break;
+      default:
+        zstring s( xml_item->getStringValue() );
+        GENV_ITEMFACTORY->createString( *json_item, s );
+        break;
+    } // switch
+    return true;
+  } // if
+  return false;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 #if ZORBA_DEBUG_JSON

=== modified file 'src/runtime/json/common.h'
--- src/runtime/json/common.h	2013-07-24 23:15:02 +0000
+++ src/runtime/json/common.h	2013-12-13 02:13:02 +0000
@@ -69,6 +69,8 @@
   set_data( *xe, je.get_loc() );
 }
 
+bool x2j_map_atomic( store::Item_t const &xml_item, store::Item_t *json_item );
+
 ///////////////////////////////////////////////////////////////////////////////
 
 #define IN_STATE(S) ztd::top_stack_equals( state_stack, (S) )

=== modified file 'src/runtime/json/json_impl.cpp'
--- src/runtime/json/json_impl.cpp	2013-07-29 23:55:03 +0000
+++ src/runtime/json/json_impl.cpp	2013-12-13 02:13:02 +0000
@@ -29,6 +29,7 @@
 #include "util/stream_util.h"
 
 #include "jsonml_array.h"
+#include "jsonml_object.h"
 #include "snelson.h"
 
 using namespace std;
@@ -71,12 +72,14 @@
   result = nullptr;
 
   { // local scope
-  options_type::mapped_type const &format = options[ "json-format" ];
-  ZORBA_ASSERT( !format.empty() );
-  if ( format == "Snelson" )
+  options_type::mapped_type const &format_opt = options[ "json-format" ];
+  ZORBA_ASSERT( !format_opt.empty() );
+  if ( format_opt == "Snelson" )
     snelson::json_to_xml( item, &result );
-  else if ( format == "JsonML-array" )
+  else if ( format_opt == "JsonML" || format_opt == "JsonML-array" )
     jsonml_array::json_to_xml( item, &result );
+  else if ( format_opt == "JsonML-object" )
+    jsonml_object::json_to_xml( item, &result );
   else
     ZORBA_ASSERT( false );
   } // local scope
@@ -108,8 +111,10 @@
       case store::StoreConsts::elementNode:
         if ( format_opt == "Snelson" )
           snelson::xml_to_json( xml_item, &result );
-        else if ( format_opt == "JsonML-array" )
+        else if ( format_opt == "JsonML" || format_opt == "JsonML-array" )
           jsonml_array::xml_to_json( xml_item, &result );
+        else if ( format_opt == "JsonML-object" )
+          jsonml_object::xml_to_json( xml_item, &result );
         else
           ZORBA_ASSERT( false );
         break;

=== modified file 'src/runtime/json/jsonml_array.cpp'
--- src/runtime/json/jsonml_array.cpp	2013-08-25 14:31:39 +0000
+++ src/runtime/json/jsonml_array.cpp	2013-12-13 02:13:02 +0000
@@ -27,43 +27,50 @@
 #include "types/root_typemanager.h"
 #include "types/typeops.h"
 #include "util/stl_util.h"
+#include "zorbautils/store_util.h"
 
+#include "common.h"
 #include "jsonml_array.h"
+#include "jsonml_common.h"
 
-// JsonML grammar
-// Source: http://www.ibm.com/developerworks/library/x-jsonml/#N10138
+// JsonML ("array form") grammar.
+// Source: http://www.jsonml.org/syntax/
 //
 // element
-//     = '[' tag-name ',' attributes ',' element-list ']'
-//     | '[' tag-name ',' attributes ']'
-//     | '[' tag-name ',' element-list ']'
-//     | '[' tag-name ']'
-//     | json-string
-//     ;
+//    = '[' tag-name ',' attributes ',' element-list ']'
+//    | '[' tag-name ',' attributes ']'
+//    | '[' tag-name ',' element-list ']'
+//    | '[' tag-name ']'
+//    | string
+//    ;
 // tag-name
-//     = json-string
-//     ;
+//    = string
+//    ;
 // attributes
-//     = '{' attribute-list '}'
-//     | '{' '}'
-//     ;
+//    = '{' attribute-list '}'
+//    | '{' '}'
+//    ;
 // attribute-list
-//     = attribute ',' attribute-list
-//     | attribute
-//     ;
+//    = attribute ',' attribute-list
+//    | attribute
+//    ;
 // attribute
-//     = attribute-name ':' attribute-value
-//     ;
+//    = attribute-name ':' attribute-value
+//    ;
 // attribute-name
-//     = json-string
-//     ;
+//    = string
+//    ;
 // attribute-value
-//     = json-string
-//     ;
+//    = string
+//    | number
+//    | 'true'
+//    | 'false'
+//    | 'null'
+//    ;
 // element-list
-//     = element ',' element-list
-//     | element
-//     ;
+//    = element ',' element-list
+//    | element
+//    ;
 
 using namespace std;
 
@@ -175,67 +182,21 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-static bool x2j_map_atomic_item( store::Item_t const &xml_item,
-                                 store::Item_t *json_item ) {
-  if ( xml_item->isAtomic() ) {
-    switch ( xml_item->getTypeCode() ) {
-      case store::JS_NULL:
-      case store::XS_BOOLEAN:
-      case store::XS_BYTE:
-      case store::XS_DECIMAL:
-      case store::XS_DOUBLE:
-      case store::XS_ENTITY:
-      case store::XS_FLOAT:
-      case store::XS_ID:
-      case store::XS_IDREF:
-      case store::XS_INT:
-      case store::XS_INTEGER:
-      case store::XS_LONG:
-      case store::XS_NAME:
-      case store::XS_NCNAME:
-      case store::XS_NEGATIVE_INTEGER:
-      case store::XS_NMTOKEN:
-      case store::XS_NON_NEGATIVE_INTEGER:
-      case store::XS_NON_POSITIVE_INTEGER:
-      case store::XS_NORMALIZED_STRING:
-      case store::XS_POSITIVE_INTEGER:
-      case store::XS_SHORT:
-      case store::XS_STRING:
-      case store::XS_TOKEN:
-      case store::XS_UNSIGNED_BYTE:
-      case store::XS_UNSIGNED_INT:
-      case store::XS_UNSIGNED_LONG:
-      case store::XS_UNSIGNED_SHORT:
-        *json_item = xml_item;
-        break;
-      default:
-        zstring s( xml_item->getStringValue() );
-        GENV_ITEMFACTORY->createString( *json_item, s );
-        break;
-    } // switch
-    return true;
-  } // if
-  return false;
-}
-
 static void x2j_attributes( store::Item_t const &element,
                             store::Item_t *json_item ) {
   ZORBA_ASSERT( json_item );
 
-  store::Item_t att_item, item;
+  store::Item_t att_item;
   vector<store::Item_t> keys, values;
 
   store::Iterator_t i( element->getAttributes() );
   i->open();
   while ( i->next( att_item ) ) {
-    zstring att_name( name_of( att_item ) );
-    if ( att_name == "xmlns" )
-      continue;
-    GENV_ITEMFACTORY->createString( item, att_name );
-    keys.push_back( item );
-    zstring att_value( att_item->getStringValue() );
-    GENV_ITEMFACTORY->createString( item, att_value );
-    values.push_back( item );
+    zstring const att_name( name_of( att_item ) );
+    if ( att_name != "xmlns" ) {
+      push_back( &keys, att_name );
+      push_back( &values, att_item->getStringValue() );
+    }
   } // while
   i->close();
   if ( !keys.empty() )
@@ -247,13 +208,13 @@
                          store::Item_t *json_item );
 
 static void x2j_children( store::Item_t const &parent,
-                          vector<store::Item_t> *elements ) {
-  ZORBA_ASSERT( elements );
+                          vector<store::Item_t> *children ) {
+  ZORBA_ASSERT( children );
   store::Iterator_t i( parent->getChildren() );
   i->open();
   store::Item_t child_item, temp_item;
   while ( i->next( child_item ) ) {
-    if ( !x2j_map_atomic_item( child_item, &temp_item ) ) {
+    if ( !x2j_map_atomic( child_item, &temp_item ) ) {
       if ( !child_item->isNode() )
         throw XQUERY_EXCEPTION(
           zerr::ZJ2X0001_JSONML_ARRAY_BAD_JSON,
@@ -272,7 +233,7 @@
           continue;
       } // switch
     } // if
-    elements->push_back( temp_item );
+    children->push_back( temp_item );
   } // while
   i->close();
 }
@@ -280,14 +241,12 @@
 static void x2j_element( store::Item_t const &element,
                          store::Item_t *json_item ) {
   ZORBA_ASSERT( json_item );
-  store::Item_t name_item, attributes_item;
+  store::Item_t attributes_item;
   vector<store::Item_t> elements;
 
-  zstring name( name_of( element ) );
-  GENV_ITEMFACTORY->createString( name_item, name );
-  elements.push_back( name_item );
+  push_back( &elements, name_of( element ) );
   x2j_attributes( element, &attributes_item );
-  if ( !attributes_item.isNull() )
+  if ( !!attributes_item )
     elements.push_back( attributes_item );
   x2j_children( element, &elements );
   GENV_ITEMFACTORY->createJSONArray( *json_item, elements );

=== modified file 'src/runtime/json/jsonml_array.h'
--- src/runtime/json/jsonml_array.h	2013-07-26 05:36:22 +0000
+++ src/runtime/json/jsonml_array.h	2013-12-13 02:13:02 +0000
@@ -18,12 +18,8 @@
 #ifndef ZORBA_RUNTIME_JSON_JSONML_ARRAY_H
 #define ZORBA_RUNTIME_JSON_JSONML_ARRAY_H
 
-#include <iostream>
-
 #include "store/api/item.h"
 
-#include "common.h"
-
 namespace zorba {
 namespace jsonml_array {
 

=== added file 'src/runtime/json/jsonml_common.cpp'
--- src/runtime/json/jsonml_common.cpp	1970-01-01 00:00:00 +0000
+++ src/runtime/json/jsonml_common.cpp	2013-12-13 02:13:02 +0000
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2006-2011 The FLWOR Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "stdafx.h"
+
+#include "store/api/item_factory.h"
+
+#include "jsonml_common.h"
+
+using namespace std;
+
+namespace zorba {
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool x2j_map_atomic( store::Item_t const &xml_item, store::Item_t *json_item ) {
+  if ( xml_item->isAtomic() ) {
+    switch ( xml_item->getTypeCode() ) {
+      case store::JS_NULL:
+      case store::XS_BOOLEAN:
+      case store::XS_BYTE:
+      case store::XS_DECIMAL:
+      case store::XS_DOUBLE:
+      case store::XS_ENTITY:
+      case store::XS_FLOAT:
+      case store::XS_ID:
+      case store::XS_IDREF:
+      case store::XS_INT:
+      case store::XS_INTEGER:
+      case store::XS_LONG:
+      case store::XS_NAME:
+      case store::XS_NCNAME:
+      case store::XS_NEGATIVE_INTEGER:
+      case store::XS_NMTOKEN:
+      case store::XS_NON_NEGATIVE_INTEGER:
+      case store::XS_NON_POSITIVE_INTEGER:
+      case store::XS_NORMALIZED_STRING:
+      case store::XS_POSITIVE_INTEGER:
+      case store::XS_SHORT:
+      case store::XS_STRING:
+      case store::XS_TOKEN:
+      case store::XS_UNSIGNED_BYTE:
+      case store::XS_UNSIGNED_INT:
+      case store::XS_UNSIGNED_LONG:
+      case store::XS_UNSIGNED_SHORT:
+        *json_item = xml_item;
+        break;
+      default:
+        zstring s( xml_item->getStringValue() );
+        GENV_ITEMFACTORY->createString( *json_item, s );
+        break;
+    } // switch
+    return true;
+  } // if
+  return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+#if ZORBA_DEBUG_JSON
+
+ostream& operator<<( ostream &o, parse_state s ) {
+  static char const *const string_of[] = {
+    "in_array",
+    "in_object"
+  };
+  return o << string_of[ s ];
+}
+
+#endif /* ZORBA_DEBUG_JSON */
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace zorba
+/* vim:set et sw=2 ts=2: */

=== added file 'src/runtime/json/jsonml_common.h'
--- src/runtime/json/jsonml_common.h	1970-01-01 00:00:00 +0000
+++ src/runtime/json/jsonml_common.h	2013-12-13 02:13:02 +0000
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006-2011 The FLWOR Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ZORBA_RUNTIME_JSON_JSONML_COMMON_H
+#define ZORBA_RUNTIME_JSON_JSONML_COMMON_H
+
+// Zorba
+#include "store/api/item.h"
+
+namespace zorba {
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool x2j_map_atomic( store::Item_t const &xml_item, store::Item_t *json_item );
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace zorba
+#endif /* ZORBA_RUNTIME_JSON_JSONML_COMMON_H */
+/* vim:set et sw=2 ts=2: */

=== added file 'src/runtime/json/jsonml_object.cpp'
--- src/runtime/json/jsonml_object.cpp	1970-01-01 00:00:00 +0000
+++ src/runtime/json/jsonml_object.cpp	2013-12-13 02:13:02 +0000
@@ -0,0 +1,273 @@
+/*
+ * Copyright 2006-2011 The FLWOR Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "stdafx.h"
+
+#include <sstream>
+
+#include <zorba/diagnostic_list.h>
+#include <zorba/internal/cxx_util.h>
+#include <zorba/store_consts.h>
+
+#include "runtime/json/json.h"
+#include "store/api/item_factory.h"
+#include "system/globalenv.h"
+#include "types/root_typemanager.h"
+#include "types/typeops.h"
+#include "util/stl_util.h"
+#include "zorbautils/store_util.h"
+
+#include "common.h"
+#include "jsonml_common.h"
+#include "jsonml_object.h"
+
+// JsonML ("object form") grammar.
+//
+// Note: there is no "object form" of JsonML.  In a JSON user group thread [1],
+// Douglas Crockford incorrectly used the term "JsonML" to describe two
+// variants: the "array form" and "object form."  This was a misuse of the term
+// JsonML which has always *only* stood to mean what Crockford referred to as
+// the "array form."
+// 
+// [1]: <http://groups.yahoo.com/neo/groups/json/conversations/topics/1115>
+//
+// element
+//    = '{' tag-name ',' attribute-list ',' elements '}'
+//    | '{' tag-name ',' attribute-list '}'
+//    | '{' tag-name ',' elements '}'
+//    | '{' tag-name '}'
+//    ;
+// tag-name
+//    "tagName" ':' string
+//    ;
+// attribute-list
+//    = attribute ',' attribute-list
+//    | attribute
+//    ;
+// attribute
+//    = attribute-name ':' attribute-value
+//    ;
+// attribute-name
+//    = string
+//    ;
+// attribute-value
+//    = string
+//    | number
+//    | 'true'
+//    | 'false'
+//    | 'null'
+//    ;
+// elements
+//    = "childNodes" : '[' element-list ']'
+//    = "childNodes" : '[' ']'
+//    ;
+// element-list
+//    = element ',' element-list
+//    = element
+//    ;
+
+using namespace std;
+
+namespace zorba {
+namespace jsonml_object {
+
+///////////////////////////////////////////////////////////////////////////////
+
+// forward declaration
+static store::Item_t j2x_object( store::Item_t const &object_item,
+                                 store::Item *parent_xml_item );
+
+static void j2x_array( store::Item_t const &array_item,
+                       store::Item *parent_xml_item ) {
+  store::Item_t item, junk_item;
+  zstring value_str;
+
+  store::Iterator_t i( array_item->getArrayValues() );
+  i->open();
+  while ( i->next( item ) ) {
+    switch ( item->getKind() ) {
+      case store::Item::ATOMIC:
+        value_str = item->getStringValue();
+        GENV_ITEMFACTORY->createTextNode(
+          junk_item, parent_xml_item, value_str
+        );
+        break;
+      case store::Item::OBJECT:
+        j2x_object( item, parent_xml_item );
+        break;
+      default:
+        throw XQUERY_EXCEPTION(
+          zerr::ZJ2X0002_JSONML_OBJECT_BAD_JSON,
+          ERROR_PARAMS( ZED( ZJ2X0002_BadElement ), item->getKind() )
+        );
+    } // switch
+  } // while
+  i->close();
+}
+
+static store::Item_t j2x_object( store::Item_t const &object_item,
+                                 store::Item *parent_xml_item ) {
+  zstring base_uri;
+  store::NsBindings ns_bindings;
+  store::Item_t element_name, key_item, type_name, xml_item;
+
+  store::Item_t name_item( get_json_value( object_item, "tagName" ) );
+  if ( !name_item )
+    throw XQUERY_EXCEPTION(
+      zerr::ZJ2X0002_JSONML_OBJECT_BAD_JSON,
+      ERROR_PARAMS( ZED( ZJ2X0002_tagNameRequired ) )
+    );
+  GENV_ITEMFACTORY->createQName(
+    element_name, "", "", name_item->getStringValue()
+  );
+  type_name = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
+  GENV_ITEMFACTORY->createElementNode(
+    xml_item, parent_xml_item,
+    element_name, type_name, false, false, ns_bindings, base_uri
+  );
+
+  store::Iterator_t k( object_item->getObjectKeys() );
+  k->open();
+  while ( k->next( key_item ) ) {
+    zstring const key_str( key_item->getStringValue() );
+    if ( key_str == "tagName" )
+      continue; // already handled
+    store::Item_t value_item( object_item->getObjectValue( key_item ) );
+    if ( key_str == "childNodes" ) {
+      if ( value_item->getKind() != store::Item::ARRAY )
+        throw XQUERY_EXCEPTION(
+          zerr::ZJ2X0002_JSONML_OBJECT_BAD_JSON,
+          ERROR_PARAMS( ZED( ZJ2X0002_childNodesArrayRequired ) )
+        );
+      j2x_array( value_item, xml_item.get() );
+    } else {
+      store::Item_t att_name, junk_item;
+      GENV_ITEMFACTORY->createQName( att_name, "", "", key_str );
+      type_name = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
+      GENV_ITEMFACTORY->createAttributeNode(
+        junk_item, xml_item, att_name, type_name, value_item
+      );
+    }
+  } // while
+  k->close();
+  return xml_item;
+}
+
+void json_to_xml( store::Item_t const &json_item, store::Item_t *xml_item ) {
+  ZORBA_ASSERT( xml_item );
+  switch ( json_item->getKind() ) {
+    case store::Item::ARRAY:
+      throw XQUERY_EXCEPTION(
+        zerr::ZJ2X0002_JSONML_OBJECT_BAD_JSON,
+        ERROR_PARAMS( ZED( ZJ2X0002_ObjectRequired ) )
+      );
+    case store::Item::OBJECT:
+      *xml_item = j2x_object( json_item, nullptr );
+      break;
+    default:
+      ZORBA_ASSERT( false );
+  }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+static void x2j_attributes( store::Item_t const &element,
+                            vector<store::Item_t> *keys,
+                            vector<store::Item_t> *values ) {
+  ZORBA_ASSERT( keys );
+  ZORBA_ASSERT( values );
+
+  store::Iterator_t i( element->getAttributes() );
+  store::Item_t att_item;
+  i->open();
+  while ( i->next( att_item ) ) {
+    zstring const name( name_of( att_item ) );
+    if ( name != "xmlns" ) {
+      push_back( keys, name );
+      push_back( values, att_item->getStringValue() );
+    }
+  } // while
+  i->close();
+}
+
+// forward declaration
+static void x2j_element( store::Item_t const &element,
+                         store::Item_t *json_item );
+
+static void x2j_children( store::Item_t const &parent,
+                          vector<store::Item_t> *children ) {
+  ZORBA_ASSERT( children );
+  store::Iterator_t i( parent->getChildren() );
+  i->open();
+  store::Item_t child_item, temp_item;
+  while ( i->next( child_item ) ) {
+    if ( !x2j_map_atomic( child_item, &temp_item ) ) {
+      if ( !child_item->isNode() )
+        throw XQUERY_EXCEPTION(
+          zerr::ZJ2X0002_JSONML_OBJECT_BAD_JSON,
+          ERROR_PARAMS( ZED( ZJ2X0002_BadElement ), child_item->getKind() )
+        );
+      switch ( child_item->getNodeKind() ) {
+        case store::StoreConsts::elementNode:
+          x2j_element( child_item, &temp_item );
+          break;
+        case store::StoreConsts::textNode: {
+          zstring s( child_item->getStringValue() );
+          GENV_ITEMFACTORY->createString( temp_item, s );
+          break;
+        }
+        default:
+          continue;
+      } // switch
+    } // if
+    children->push_back( temp_item );
+  } // while
+  i->close();
+}
+
+static void x2j_element( store::Item_t const &element,
+                         store::Item_t *json_item ) {
+  ZORBA_ASSERT( json_item );
+  vector<store::Item_t> keys, values, children;
+
+  push_back( &keys, "tagName" );
+  push_back( &values, name_of( element ) );
+  x2j_attributes( element, &keys, &values );
+  x2j_children( element, &children );
+  if ( !children.empty() ) {
+    push_back( &keys, "childNodes" );
+    store::Item_t temp;
+    GENV_ITEMFACTORY->createJSONArray( temp, children );
+    values.push_back( temp );
+  }
+  GENV_ITEMFACTORY->createJSONObject( *json_item, keys, values );
+}
+
+void xml_to_json( store::Item_t const &xml_item, store::Item_t *json_item ) {
+  ZORBA_ASSERT( json_item );
+  switch ( xml_item->getNodeKind() ) {
+    case store::StoreConsts::elementNode:
+      x2j_element( xml_item, json_item );
+      break;
+    default:
+      throw XQUERY_EXCEPTION( zerr::ZJSE0001_NOT_ELEMENT_NODE );
+  }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace jsonml_object
+} // namespace zorba
+/* vim:set et sw=2 ts=2: */

=== added file 'src/runtime/json/jsonml_object.h'
--- src/runtime/json/jsonml_object.h	1970-01-01 00:00:00 +0000
+++ src/runtime/json/jsonml_object.h	2013-12-13 02:13:02 +0000
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2006-2011 The FLWOR Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "stdafx.h"
+
+#ifndef ZORBA_RUNTIME_JSON_JSONML_OBJECT_H
+#define ZORBA_RUNTIME_JSON_JSONML_OBJECT_H
+
+#include "store/api/item.h"
+
+namespace zorba {
+namespace jsonml_object {
+
+///////////////////////////////////////////////////////////////////////////////
+
+void json_to_xml( store::Item_t const &json_item, store::Item_t *xml_item );
+void xml_to_json( store::Item_t const &xml_item, store::Item_t *json_item );
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace jsonml_object
+} // namespace zorba
+#endif /* ZORBA_RUNTIME_JSON_JSONML_OBJECT_H */
+/* vim:set et sw=2 ts=2: */

=== modified file 'src/zorbautils/CMakeLists.txt'
--- src/zorbautils/CMakeLists.txt	2013-06-11 23:38:49 +0000
+++ src/zorbautils/CMakeLists.txt	2013-12-13 02:13:02 +0000
@@ -23,6 +23,7 @@
     lock.cpp
     runnable.cpp
     synchronous_logger.cpp
+    store_util.cpp
     string_util.cpp)
 
 IF (ZORBA_WITH_LIBXML2_SAX)

=== added file 'src/zorbautils/store_util.cpp'
--- src/zorbautils/store_util.cpp	1970-01-01 00:00:00 +0000
+++ src/zorbautils/store_util.cpp	2013-12-13 02:13:02 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006-2013 The FLWOR Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "store/api/item_factory.h"
+#include "system/globalenv.h"
+
+#include "store_util.h"
+
+using namespace std;
+
+namespace zorba { 
+
+///////////////////////////////////////////////////////////////////////////////
+
+store::Item_t get_json_value( store::Item_t const &json_object,
+                              char const *key ) {
+  zstring s( key );
+  store::Item_t key_item;
+  GENV_ITEMFACTORY->createString( key_item, s );
+  return json_object->getObjectValue( key_item );
+}
+
+void push_back( vector<store::Item_t> *v, char const *s ) {
+  zstring s2( s );
+  store::Item_t item;
+  GENV_ITEMFACTORY->createString( item, s2 );
+  v->push_back( item );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace zorba
+/* vim:set et sw=2 ts=2: */

=== added file 'src/zorbautils/store_util.h'
--- src/zorbautils/store_util.h	1970-01-01 00:00:00 +0000
+++ src/zorbautils/store_util.h	2013-12-13 02:13:02 +0000
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2006-2013 The FLWOR Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+#ifndef ZORBA_STORE_UTIL_H
+#define ZORBA_STORE_UTIL_H
+
+#include <vector>
+
+#include <zorba/internal/ztd.h>
+
+#include "store/api/item.h"
+
+namespace zorba { 
+
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Convenience function for getting the value for the given key of a JSON
+ * object.
+ *
+ * @param json_object The JSON object to get the value from.
+ * @param key The key to get the value for.
+ * @return Returns said value.
+ */
+store::Item_t get_json_value( store::Item_t const &json_object,
+                              char const *key );
+
+/**
+ * Pushes a newly created string Item onto the back of the given vector.
+ *
+ * @param v A pointer to the vector to push the new Item onto the back of.
+ * @param s The string to create the string Item from.
+ */
+void push_back( std::vector<store::Item_t> *v, char const *s );
+
+/**
+ * Pushes a newly created string Item onto the back of the given vector.
+ *
+ * @tparam The stiring type.
+ * @param v A pointer to the vector to push the new Item onto the back of.
+ * @param s The string to create the string Item from.
+ */
+template<class StringType> inline
+typename std::enable_if<ZORBA_HAS_C_STR(StringType),void>::type
+push_back( std::vector<store::Item_t> *v, StringType const &s ) {
+  push_back( v, s.c_str() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace zorba
+#endif /* ZORBA_STORE_UTIL_H */
+/* vim:set et sw=2 ts=2: */

=== modified file 'test/rbkt/ExpQueryResults/zorba/json/json-jmla-x2j-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-jmla-x2j-03.xml.res	2013-07-25 03:41:28 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-jmla-x2j-03.xml.res	2013-12-13 02:13:02 +0000
@@ -1,1 +1,6 @@
-[ "file", { "dir" : "/tmp", "name" : "foo", "size" : "1234", "modified" : "2006-12-31T23:59" } ]
+[ "file", {
+  "dir" : "/tmp", 
+  "name" : "foo", 
+  "size" : "1234", 
+  "modified" : "2006-12-31T23:59"
+} ]

=== modified file 'test/rbkt/ExpQueryResults/zorba/json/json-jmla-x2j-wikipedia.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-jmla-x2j-wikipedia.xml.res	2013-07-25 03:41:28 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-jmla-x2j-wikipedia.xml.res	2013-12-13 02:13:02 +0000
@@ -1,1 +1,6 @@
-[ "person", { "created" : "2006-11-11T19:23", "modified" : "2006-12-31T23:59" }, [ "firstName", "Robert" ], [ "lastName", "Smith" ], [ "address", { "type" : "home" }, [ "street", "12345 Sixth Ave" ], [ "city", "Anytown" ], [ "state", "CA" ], [ "postalCode", "98765-4321" ] ] ]
+[ "person", {
+  "created" : "2006-11-11T19:23", 
+  "modified" : "2006-12-31T23:59"
+}, [ "firstName", "Robert" ], [ "lastName", "Smith" ], [ "address", {
+  "type" : "home"
+}, [ "street", "12345 Sixth Ave" ], [ "city", "Anytown" ], [ "state", "CA" ], [ "postalCode", "98765-4321" ] ] ]

=== added file 'test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-01.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-01.xml.res	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+<li>list item</li>

=== added file 'test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-02.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-02.xml.res	2013-12-13 02:13:02 +0000
@@ -0,0 +1,4 @@
+<ul>
+  <li>list item 1</li>
+  <li>list item 2</li>
+</ul>

=== added file 'test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-03.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-03.xml.res	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+<file dir="/tmp" name="foo" size="1234" modified="2006-12-31T23:59"/>

=== added file 'test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-04.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-04.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-04.xml.res	2013-12-13 02:13:02 +0000
@@ -0,0 +1,6 @@
+<ul>
+  <li style="color:red">First Item</li>
+  <li title="Some hover text." style="color:green">Second Item</li>
+  <li>
+    <span class="code-example-third">Third</span> Item</li>
+</ul>

=== added file 'test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-05.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-05.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-05.xml.res	2013-12-13 02:13:02 +0000
@@ -0,0 +1,14 @@
+<table class="MyTable" style="background-color:yellow">
+  <tr>
+    <td class="MyTD" style="border:1px solid black">#550758</td>
+    <td class="MyTD" style="background-color:red">Example text here</td>
+  </tr>
+  <tr>
+    <td class="MyTD" style="border:1px solid black">#993101</td>
+    <td class="MyTD" style="background-color:green">127624015</td>
+  </tr>
+  <tr>
+    <td class="MyTD" style="border:1px solid black">#E33D87</td>
+    <td class="MyTD" style="background-color:blue"> <span style="background-color:maroon">©</span> </td>
+  </tr>
+</table>

=== added file 'test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-wikipedia.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-wikipedia.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-jmlo-j2x-wikipedia.xml.res	2013-12-13 02:13:02 +0000
@@ -0,0 +1,10 @@
+<person created="2006-11-11T19:23" modified="2006-12-31T23:59">
+  <firstName>Robert</firstName>
+  <lastName>Smith</lastName>
+  <address type="home">
+    <street>12345 Sixth Ave</street>
+    <city>Anytown</city>
+    <state>CA</state>
+    <postalCode>98765-4321</postalCode>
+  </address>
+</person>

=== added file 'test/rbkt/ExpQueryResults/zorba/json/json-jmlo-x2j-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-jmlo-x2j-01.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-jmlo-x2j-01.xml.res	2013-12-13 02:13:02 +0000
@@ -0,0 +1,4 @@
+{
+  "tagName" : "li", 
+  "childNodes" : [ "list item" ]
+}

=== added file 'test/rbkt/ExpQueryResults/zorba/json/json-jmlo-x2j-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-jmlo-x2j-02.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-jmlo-x2j-02.xml.res	2013-12-13 02:13:02 +0000
@@ -0,0 +1,10 @@
+{
+  "tagName" : "ul", 
+  "childNodes" : [ {
+    "tagName" : "li", 
+    "childNodes" : [ "list item 1" ]
+  }, {
+    "tagName" : "li", 
+    "childNodes" : [ "list item 2" ]
+  } ]
+}

=== added file 'test/rbkt/ExpQueryResults/zorba/json/json-jmlo-x2j-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-jmlo-x2j-03.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-jmlo-x2j-03.xml.res	2013-12-13 02:13:02 +0000
@@ -0,0 +1,7 @@
+{
+  "tagName" : "file", 
+  "dir" : "/tmp", 
+  "name" : "foo", 
+  "size" : "1234", 
+  "modified" : "2006-12-31T23:59"
+}

=== added file 'test/rbkt/ExpQueryResults/zorba/json/json-jmlo-x2j-wikipedia.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-jmlo-x2j-wikipedia.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-jmlo-x2j-wikipedia.xml.res	2013-12-13 02:13:02 +0000
@@ -0,0 +1,28 @@
+{
+  "tagName" : "person", 
+  "created" : "2006-11-11T19:23", 
+  "modified" : "2006-12-31T23:59", 
+  "childNodes" : [ {
+    "tagName" : "firstName", 
+    "childNodes" : [ "Robert" ]
+  }, {
+    "tagName" : "lastName", 
+    "childNodes" : [ "Smith" ]
+  }, {
+    "tagName" : "address", 
+    "type" : "home", 
+    "childNodes" : [ {
+      "tagName" : "street", 
+      "childNodes" : [ "12345 Sixth Ave" ]
+    }, {
+      "tagName" : "city", 
+      "childNodes" : [ "Anytown" ]
+    }, {
+      "tagName" : "state", 
+      "childNodes" : [ "CA" ]
+    }, {
+      "tagName" : "postalCode", 
+      "childNodes" : [ "98765-4321" ]
+    } ]
+  } ]
+}

=== added file 'test/rbkt/Queries/zorba/json/json-jmla-x2j-01.spec'
--- test/rbkt/Queries/zorba/json/json-jmla-x2j-01.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmla-x2j-01.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes

=== added file 'test/rbkt/Queries/zorba/json/json-jmla-x2j-02.spec'
--- test/rbkt/Queries/zorba/json/json-jmla-x2j-02.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmla-x2j-02.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes

=== added file 'test/rbkt/Queries/zorba/json/json-jmla-x2j-03.spec'
--- test/rbkt/Queries/zorba/json/json-jmla-x2j-03.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmla-x2j-03.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes

=== added file 'test/rbkt/Queries/zorba/json/json-jmla-x2j-wikipedia.spec'
--- test/rbkt/Queries/zorba/json/json-jmla-x2j-wikipedia.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmla-x2j-wikipedia.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-01.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-01.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-01.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,13 @@
+(: Simple JsonML (object form) :)
+
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $json :=
+  {
+    "tagName": "li",
+    "childNodes" : [ "list item" ]
+  }
+let $options := { "json-format" : "JsonML-object" }
+return jx:json-to-xml( $json, $options )
+
+(: vim:set et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-02.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-02.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-02.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,16 @@
+(: Multi-level JsonML (object form) :)
+
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $json :=
+  {
+    "tagName" : "ul",
+    "childNodes" : [
+      { "tagName" : "li", "childNodes" : [ "list item 1" ] },
+      { "tagName" : "li", "childNodes" : [ "list item 2" ] }
+    ]
+  }
+let $options := { "json-format" : "JsonML-object" }
+return jx:json-to-xml( $json, $options )
+
+(: vim:set et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-03.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-03.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-03.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,16 @@
+(: JsonML (object form) with attributes :)
+
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $json :=
+  {
+    "tagName" : "file",
+    "dir" : "/tmp",
+    "name" : "foo",
+    "size" : 1234,
+    "modified" : "2006-12-31T23:59"
+  }
+let $options := { "json-format" : "JsonML-object" }
+return jx:json-to-xml( $json, $options )
+
+(: vim:set et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-04.spec'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-04.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-04.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Comparison: Fragment

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-04.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-04.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-04.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,34 @@
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $json :=
+  {
+    "tagName" : "ul",
+    "childNodes" : [
+      {
+        "tagName" : "li",
+        "style" : "color:red",
+        "childNodes" : [ "First Item" ]
+      },
+      {
+        "tagName" : "li",
+        "title" : "Some hover text.",
+        "style" : "color:green",
+        "childNodes" : [ "Second Item" ]
+      },
+      {
+        "tagName" : "li",
+        "childNodes" : [
+          {
+            "tagName" : "span",
+            "class" : "code-example-third",
+            "childNodes" : [ "Third" ]
+          },
+          " Item"
+        ]
+      }
+    ]
+  }
+let $options := { "json-format" : "JsonML-object" }
+return jx:json-to-xml( $json, $options )
+
+(: vim:se et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-05.spec'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-05.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-05.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Comparison: Fragment

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-05.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-05.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-05.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,58 @@
+jsoniq version "1.0";
+
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $j :=
+  {
+    "tagName" : "table", 
+    "class" : "MyTable", 
+    "style" : "background-color:yellow", 
+    "childNodes" : [ {
+      "tagName" : "tr", 
+      "childNodes" : [ {
+        "tagName" : "td", 
+        "class" : "MyTD", 
+        "style" : "border:1px solid black", 
+        "childNodes" : [ "#550758" ]
+      }, {
+        "tagName" : "td", 
+        "class" : "MyTD", 
+        "style" : "background-color:red", 
+        "childNodes" : [ "Example text here" ]
+      } ]
+    }, {
+      "tagName" : "tr", 
+      "childNodes" : [ {
+        "tagName" : "td", 
+        "class" : "MyTD", 
+        "style" : "border:1px solid black", 
+        "childNodes" : [ "#993101" ]
+      }, {
+        "tagName" : "td", 
+        "class" : "MyTD", 
+        "style" : "background-color:green", 
+        "childNodes" : [ "127624015" ]
+      } ]
+    }, {
+      "tagName" : "tr", 
+      "childNodes" : [ {
+        "tagName" : "td", 
+        "class" : "MyTD", 
+        "style" : "border:1px solid black", 
+        "childNodes" : [ "#E33D87" ]
+      }, {
+        "tagName" : "td", 
+        "class" : "MyTD", 
+        "style" : "background-color:blue", 
+        "childNodes" : [ " ", {
+          "tagName" : "span", 
+          "style" : "background-color:maroon", 
+          "childNodes" : [ "\u00A9" ]
+        }, " " ]
+      } ]
+    } ]
+  }
+let $options := { "json-format" : "JsonML-object" }
+return jx:json-to-xml( $j, $options )
+
+(: vim:se et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-06.spec'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-06.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-06.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Error: http://zorba.io/errors:ZJ2X0002

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-06.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-06.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-06.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,9 @@
+(: try parsing an empty value :)
+
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $json := { }
+let $options := { "json-format" : "JsonML-object" }
+return jx:json-to-xml( $json, $options )
+
+(: vim:set et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-07.spec'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-07.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-07.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Error: http://zorba.io/errors:ZJ2X0002

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-07.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-07.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-07.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,7 @@
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $json := [ "args", "<div><span>foo:</span> parse</div>" ]
+let $options := { "json-format" : "JsonML-object" }
+return jx:json-to-xml( $json, $options )
+
+(: vim:set et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-08.spec'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-08.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-08.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Error: http://zorba.io/errors:ZJ2X0002

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-08.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-08.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-08.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,7 @@
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $json := { "x" : "x" }
+let $options := { "json-format" : "JsonML-object" }
+return jx:json-to-xml( $json, $options )
+
+(: vim:set et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-j2x-wikipedia.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-j2x-wikipedia.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-j2x-wikipedia.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,44 @@
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $json :=
+  {
+    "tagName" : "person", 
+    "created" : "2006-11-11T19:23", 
+    "modified" : "2006-12-31T23:59", 
+    "childNodes" : [
+      {
+        "tagName" : "firstName", 
+        "childNodes" : [ "Robert" ]
+      },
+      {
+        "tagName" : "lastName", 
+        "childNodes" : [ "Smith" ]
+      },
+      {
+        "tagName" : "address", 
+        "type" : "home", 
+        "childNodes" : [
+          {
+            "tagName" : "street", 
+            "childNodes" : [ "12345 Sixth Ave" ]
+          },
+          {
+            "tagName" : "city", 
+            "childNodes" : [ "Anytown" ]
+          },
+          {
+            "tagName" : "state", 
+            "childNodes" : [ "CA" ]
+          },
+          {
+            "tagName" : "postalCode", 
+            "childNodes" : [ "98765-4321" ]
+          }
+        ]
+      }
+    ]
+  }
+let $options := { "json-format" : "JsonML-object" }
+return jx:json-to-xml( $json, $options )
+
+(: vim:set et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-x2j-01.spec'
--- test/rbkt/Queries/zorba/json/json-jmlo-x2j-01.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-x2j-01.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-x2j-01.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-x2j-01.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-x2j-01.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,7 @@
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $xml := <li>list item</li>
+let $options := { "json-format" : "JsonML-object" }
+return jx:xml-to-json( $xml, $options )
+
+(: vim:set et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-x2j-02.spec'
--- test/rbkt/Queries/zorba/json/json-jmlo-x2j-02.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-x2j-02.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-x2j-02.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-x2j-02.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-x2j-02.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,11 @@
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $xml :=
+  <ul>
+    <li>list item 1</li>
+    <li>list item 2</li>
+  </ul>
+let $options := { "json-format" : "JsonML-object" }
+return jx:xml-to-json( $xml, $options )
+
+(: vim:set et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-x2j-03.spec'
--- test/rbkt/Queries/zorba/json/json-jmlo-x2j-03.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-x2j-03.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-x2j-03.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-x2j-03.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-x2j-03.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,8 @@
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $xml :=
+  <file dir="/tmp" name="foo" size="1234" modified="2006-12-31T23:59"/>
+let $options := { "json-format" : "JsonML-object" }
+return jx:xml-to-json( $xml, $options )
+
+(: vim:set et sw=2 ts=2: :)

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-x2j-wikipedia.spec'
--- test/rbkt/Queries/zorba/json/json-jmlo-x2j-wikipedia.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-x2j-wikipedia.spec	2013-12-13 02:13:02 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes

=== added file 'test/rbkt/Queries/zorba/json/json-jmlo-x2j-wikipedia.xq'
--- test/rbkt/Queries/zorba/json/json-jmlo-x2j-wikipedia.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-jmlo-x2j-wikipedia.xq	2013-12-13 02:13:02 +0000
@@ -0,0 +1,17 @@
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $xml :=
+  <person created="2006-11-11T19:23" modified="2006-12-31T23:59">
+    <firstName>Robert</firstName>
+    <lastName>Smith</lastName>
+    <address type="home">
+      <street>12345 Sixth Ave</street>
+      <city>Anytown</city>
+      <state>CA</state>
+      <postalCode>98765-4321</postalCode>
+    </address>
+  </person>
+let $options := { "json-format" : "JsonML-object" }
+return jx:xml-to-json( $xml, $options )
+
+(: vim:set et sw=2 ts=2: :)


Follow ups