Loading ...
Sorry, an error occurred while loading the content.

Re: SV: [json] JSON representation for XML snippet

Expand Messages
  • Andrea Giammarchi
    just use a non valid attribute name as JSON property, so you won t have ambiguity in the parser. value2 will be
    Message 1 of 28 , Sep 14, 2009
    • 0 Attachment
      just use a non valid attribute name as JSON property, so you won't have
      ambiguity in the parser.

      <attribute a2="v2">value2</attribute>
      will be
      {"attribute":{"a2":"v2"},"#text":"value2"}

      as example ... while JSONML uses this kind of schema

      ["nodeName",{"a2":"v2"},"text or nested nodes"]

      so that this:

      <attributes>
      <attribute a2="v2">value2</attribute>
      </attributes>

      will be this

      ["attributes",{},["attribute",{"a2":"v2"},"value2"]]

      Regards

      On Mon, Sep 14, 2009 at 10:23 PM, Shalab Goel <goel.shalab@...> wrote:

      >
      > But how about when both XML element's text and attributes are specified
      > as in
      >
      > <attribute a2="v2">value2</attribute>
      >
      > Thanks
      > Shalab
      >


      [Non-text portions of this message have been removed]
    • Mark Joseph
      Handling XML attributes when converting to JSON: ************************************** value2 will be
      Message 2 of 28 , Sep 16, 2009
      • 0 Attachment
        Handling XML attributes when converting to JSON:
        **************************************
        <attribute a2="v2">value2</attribute>
        will be
        {"attribute":{"a2":"v2"},"#text":"value2"}

        as example ... while JSONML uses this kind of schema

        ["nodeName",{"a2":"v2"},"text or nested nodes"]

        so that this:

        <attributes>
        <attribute a2="v2">value2</attribute>
        </attributes>

        will be this

        ["attributes",{},["attribute",{"a2":"v2"},"value2"]]
        ****************************************

        So all of the above works well when you have simple XML.
        But with something like:

        <node1 a="45">
        <node2 b="9" c="hithere">
        <node3 d="abc">
        <node4 e="12345">JSON has no attributes</node4>
        </node3>
        </node2>
        Now is the time for all good men to come to the aid of their party

        <node5 d="45">temperature is 70 degrees today</node5>
        </node1>

        The resulting JSON is going to be "ugly". Many added arrays
        are added to handle the attributes and nested nodes now appear in the
        added arrays. To me this adds a lot of extra complexity that I am
        not sure I want.



        Best,
        Mark Joseph, Ph.D.
        P6R, Inc
      • stephen.mckamey
        The encoding used by JsonML isn t prioritized to be pretty or even really encoded by humans. It is intended to be compact and loss-less.
        Message 3 of 28 , Sep 17, 2009
        • 0 Attachment
          The encoding used by JsonML <http://jsonml.org> isn't prioritized to be "pretty" or even really encoded by humans. It is intended to be compact and loss-less. This means it can unambiguously encode and decode valid XML. Namespaces are handled the same way as XML 1.0: as part of the element (or attribute) name.

          Off-topic: Where JsonML really fills a void is its ability to be extended to be a full intermediate language for client-side templates. Templates are written by humans in an ASP/JSP style syntax and then compiled to JsonML+Browser-Side Templates (JBST) <http://bit.ly/2poc6d>. No parsing has to take place in the browser, and the site markup may be fully compacted and cached with the rest of the scripts as it is now pure JavaScript.

          --- In json@yahoogroups.com, "Mark Joseph" <mark@...> wrote:
          >
          >
          > Handling XML attributes when converting to JSON:
          > **************************************
          > <attribute a2="v2">value2</attribute>
          > will be
          > {"attribute":{"a2":"v2"},"#text":"value2"}
          >
          > as example ... while JSONML uses this kind of schema
          >
          > ["nodeName",{"a2":"v2"},"text or nested nodes"]
          >
          > so that this:
          >
          > <attributes>
          > <attribute a2="v2">value2</attribute>
          > </attributes>
          >
          > will be this
          >
          > ["attributes",{},["attribute",{"a2":"v2"},"value2"]]
          > ****************************************
          >
          > So all of the above works well when you have simple XML.
          > But with something like:
          >
          > <node1 a="45">
          > <node2 b="9" c="hithere">
          > <node3 d="abc">
          > <node4 e="12345">JSON has no attributes</node4>
          > </node3>
          > </node2>
          > Now is the time for all good men to come to the aid of their party
          >
          > <node5 d="45">temperature is 70 degrees today</node5>
          > </node1>
          >
          > The resulting JSON is going to be "ugly". Many added arrays
          > are added to handle the attributes and nested nodes now appear in the
          > added arrays. To me this adds a lot of extra complexity that I am
          > not sure I want.
          >
          >
          >
          > Best,
          > Mark Joseph, Ph.D.
          > P6R, Inc
        • Mark Joseph
          For people interested in this topic. We are always open to comments and questions. https://www.p6r.com/articles/2010/04/05/xml-to-json-and-back/ Best, Mark
          Message 4 of 28 , Apr 5 5:47 PM
          • 0 Attachment
            For people interested in this topic. We are always open to comments and questions.

            https://www.p6r.com/articles/2010/04/05/xml-to-json-and-back/


            Best,

            Mark Joseph, Ph.D.
            President
            P6R, Inc
            408-205-0361
            mark@...
            Skype: markjoseph_sc



            [Non-text portions of this message have been removed]
          • Dennis Gearon
            I m not really interested in this at the moment. BUT, very nice technical work! If I do need it in the future, it s nice to see good quality ideas and
            Message 5 of 28 , Apr 5 9:02 PM
            • 0 Attachment
              I'm not really interested in this at the moment.

              BUT, very nice technical work! If I do need it in the future, it's nice to see good quality ideas and implentation that I can look for and utilize.

              Keep up the good work.

              Dennis Gearon



              Signature Warning

              ----------------

              EARTH has a Right To Life,

              otherwise we all die.



              Read 'Hot, Flat, and Crowded'

              Laugh at http://www.yert.com/film.php

              --- On Mon, 4/5/10, Mark Joseph <mark@...> wrote:

              From: Mark Joseph <mark@...>
              Subject: [json] Where our JSON product is heading: XML to JSON and Back
              To: json@yahoogroups.com
              Date: Monday, April 5, 2010, 5:47 PM







               









              For people interested in this topic. We are always open to comments and questions.



              https://www. p6r.com/articles /2010/04/ 05/xml-to- json-and- back/



              Best,



              Mark Joseph, Ph.D.

              President

              P6R, Inc

              408-205-0361

              mark@...

              Skype: markjoseph_sc



              [Non-text portions of this message have been removed]






















              [Non-text portions of this message have been removed]
            • stephen.mckamey
              JsonML ( http://jsonml.org ) handles all of these issues and has been embraced by quite a number of places. Many JSON encoders already include support. It
              Message 6 of 28 , Apr 6 10:11 AM
              • 0 Attachment
                JsonML ( http://jsonml.org ) handles all of these issues and has been embraced by quite a number of places. Many JSON encoders already include support.

                It handles namespaces the same way that XML 1.0 did: include the name as "prefix:local-name" and the URI to prefix mapping (xmlns:abc="http://example.com/abc") as the attribute of the node that declared it.

                An early implementation of JsonML took a similar approach to including a child object, but ultimately after some design discussions with Douglas Crockford, his suggestion was to make the actual element an array like the child object and have the element name be the first item.

                This positional structure has been the biggest part that people have disliked about JsonML, but yet in many XML documents (XHTML for example, being the primary use case) position of the child nodes is critical to the meaning of the document. So you get much smaller documents when you just add the element name as the first child and make elements arrays.

                I'd encourage you to embrace JsonML and contribute to a standard that has been around for four years already rather than creating a slightly different approach.


                --- In json@yahoogroups.com, "Mark Joseph" <mark@...> wrote:
                >
                > For people interested in this topic. We are always open to comments and questions.
                >
                > https://www.p6r.com/articles/2010/04/05/xml-to-json-and-back/
                >
                >
                > Best,
                >
                > Mark Joseph, Ph.D.
                > President
                > P6R, Inc
                > 408-205-0361
                > mark@...
                > Skype: markjoseph_sc
                >
                >
                >
                > [Non-text portions of this message have been removed]
                >
              • stephen.mckamey
                Not that ugly: [ node1 , { a : 45 }, [ node2 , { b : 9 , c : hithere }, [ node3 , { d : abc }, [ node4 , { e : 12345 }, JSON has no attributes ] ] ], Now is
                Message 7 of 28 , Apr 6 10:20 AM
                • 0 Attachment
                  Not that ugly:

                  ["node1", {"a":"45"},
                  ["node2", {"b":"9", "c":"hithere"},
                  ["node3", {"d":"abc"},
                  ["node4", {"e":"12345"}, "JSON has no attributes"]
                  ]
                  ],
                  "Now is the time for all good men to come to the aid of their party",

                  ["node5", {"d":"45"}, "temperature is 70 degrees today"]
                  ]

                  --- In json@yahoogroups.com, "Mark Joseph" <mark@...> wrote:
                  >
                  >
                  > Handling XML attributes when converting to JSON:
                  > **************************************
                  > <attribute a2="v2">value2</attribute>
                  > will be
                  > {"attribute":{"a2":"v2"},"#text":"value2"}
                  >
                  > as example ... while JSONML uses this kind of schema
                  >
                  > ["nodeName",{"a2":"v2"},"text or nested nodes"]
                  >
                  > so that this:
                  >
                  > <attributes>
                  > <attribute a2="v2">value2</attribute>
                  > </attributes>
                  >
                  > will be this
                  >
                  > ["attributes",{},["attribute",{"a2":"v2"},"value2"]]
                  > ****************************************
                  >
                  > So all of the above works well when you have simple XML.
                  > But with something like:
                  >
                  > <node1 a="45">
                  > <node2 b="9" c="hithere">
                  > <node3 d="abc">
                  > <node4 e="12345">JSON has no attributes</node4>
                  > </node3>
                  > </node2>
                  > Now is the time for all good men to come to the aid of their party
                  >
                  > <node5 d="45">temperature is 70 degrees today</node5>
                  > </node1>
                  >
                  > The resulting JSON is going to be "ugly". Many added arrays
                  > are added to handle the attributes and nested nodes now appear in the
                  > added arrays. To me this adds a lot of extra complexity that I am
                  > not sure I want.
                  >
                  >
                  >
                  > Best,
                  > Mark Joseph, Ph.D.
                  > P6R, Inc
                  >
                • Mark Joseph
                  Cool stuff, can you show me an example of how JsonML handles XML mixed content, that is not clear to me from the web site. And just so it is clear to me, the
                  Message 8 of 28 , Apr 6 11:19 AM
                  • 0 Attachment
                    Cool stuff, can you show me an example of how JsonML handles XML mixed content, that is not clear to me from the web site.


                    And just so it is clear to me, the namespace example would be something like:

                    <description abc="http://example.com"><abc:title>hi there</abc:title></description>

                    becomes

                    [ "description", {"abc" : "http://example.com"},
                    [ "abc:title", {}, "hi there" ]
                    ]

                    So the JSON application has to find the meaning of "abc:title", if it cares, like XML applications do by looking for the first enclosing element with
                    a definition for "abc"?



                    Thanks,

                    Mark Joseph, Ph.D.
                    President
                    P6R, Inc
                    408-205-0361
                    mark@...
                    Skype: markjoseph_sc
                    _____

                    From: stephen.mckamey [mailto:stephen@...]
                    To: json@yahoogroups.com
                    Sent: Tue, 06 Apr 2010 10:11:22 -0700
                    Subject: [json] Re: Where our JSON product is heading: XML to JSON and Back








                    JsonML ( http://jsonml.org ) handles all of these issues and has been embraced by quite a number of places. Many JSON encoders already include support.

                    It handles namespaces the same way that XML 1.0 did: include the name as "prefix:local-name" and the URI to prefix mapping (xmlns:abc="http://example.com/abc") as the attribute of the node that declared it.

                    An early implementation of JsonML took a similar approach to including a child object, but ultimately after some design discussions with Douglas Crockford, his suggestion was to make the actual element an array like the child object and have the element name be the first item.

                    This positional structure has been the biggest part that people have disliked about JsonML, but yet in many XML documents (XHTML for example, being the primary use case) position of the child nodes is critical to the meaning of the document. So you get much smaller documents when you just add the element name as the first child and make elements arrays.

                    I'd encourage you to embrace JsonML and contribute to a standard that has been around for four years already rather than creating a slightly different approach.

                    --- In json@yahoogroups.com, "Mark Joseph" <mark@...> wrote:
                    >
                    > For people interested in this topic. We are always open to comments and questions.
                    >
                    > https://www.p6r.com/articles/2010/04/05/xml-to-json-and-back/
                    >
                    >
                    > Best,
                    >
                    > Mark Joseph, Ph.D.
                    > President
                    > P6R, Inc
                    > 408-205-0361
                    > mark@...
                    > Skype: markjoseph_sc
                    >
                    >
                    >
                    > [Non-text portions of this message have been removed]
                    >




                    [Non-text portions of this message have been removed]
                  • Mark Joseph
                    Ok I think I see how mixed content works in JsonML: hi there joe how are you becomes [ description ,
                    Message 9 of 28 , Apr 6 11:35 AM
                    • 0 Attachment
                      Ok I think I see how mixed content works in JsonML:

                      <description lang="en-us"> hi there <bold>joe</bold> how are you </descrption>

                      becomes

                      [ "description", {"lang":"en-us"},
                      " hi there ",
                      [ "bold", "joe" ],
                      " how are you "
                      ]

                      Is that right?


                      Best,

                      Mark Joseph, Ph.D.
                      President
                      P6R, Inc
                      408-205-0361
                      mark@...
                      Skype: markjoseph_sc
                      _____

                      From: stephen.mckamey [mailto:stephen@...]
                      To: json@yahoogroups.com
                      Sent: Tue, 06 Apr 2010 10:20:12 -0700
                      Subject: Re: SV: [json] JSON representation for XML snippet






                      Not that ugly:

                      ["node1", {"a":"45"},
                      ["node2", {"b":"9", "c":"hithere"},
                      ["node3", {"d":"abc"},
                      ["node4", {"e":"12345"}, "JSON has no attributes"]
                      ]
                      ],
                      "Now is the time for all good men to come to the aid of their party",

                      ["node5", {"d":"45"}, "temperature is 70 degrees today"]
                      ]

                      --- In json@yahoogroups.com, "Mark Joseph" <mark@...> wrote:
                      >
                      >
                      > Handling XML attributes when converting to JSON:
                      > **************************************
                      > <attribute a2="v2">value2</attribute>
                      > will be
                      > {"attribute":{"a2":"v2"},"#text":"value2"}
                      >
                      > as example ... while JSONML uses this kind of schema
                      >
                      > ["nodeName",{"a2":"v2"},"text or nested nodes"]
                      >
                      > so that this:
                      >
                      > <attributes>
                      > <attribute a2="v2">value2</attribute>
                      > </attributes>
                      >
                      > will be this
                      >
                      > ["attributes",{},["attribute",{"a2":"v2"},"value2"]]
                      > ****************************************
                      >
                      > So all of the above works well when you have simple XML.
                      > But with something like:
                      >
                      > <node1 a="45">
                      > <node2 b="9" c="hithere">
                      > <node3 d="abc">
                      > <node4 e="12345">JSON has no attributes</node4>
                      > </node3>
                      > </node2>
                      > Now is the time for all good men to come to the aid of their party
                      >
                      > <node5 d="45">temperature is 70 degrees today</node5>
                      > </node1>
                      >
                      > The resulting JSON is going to be "ugly". Many added arrays
                      > are added to handle the attributes and nested nodes now appear in the
                      > added arrays. To me this adds a lot of extra complexity that I am
                      > not sure I want.
                      >
                      >
                      >
                      > Best,
                      > Mark Joseph, Ph.D.
                      > P6R, Inc
                      >




                      [Non-text portions of this message have been removed]
                    • stephen.mckamey
                      The attributes object is optional (see the BNF at http://jsonml.org) so you can drop it if empty to make more compact. The example XML:
                      Message 10 of 28 , Apr 6 11:43 AM
                      • 0 Attachment
                        The attributes object is optional (see the BNF at http://jsonml.org) so you can drop it if empty to make more compact.

                        The example XML:

                        <description abc="http://example.com">
                        <abc:title>hi there</abc:title>
                        </description>

                        would encode in JsonML as:

                        ["description", {"abc":"http://example.com"},
                        ["abc:title", "hi there"]
                        ]

                        To encode mixed content, I think you mean like this:

                        <div class="section">
                        <p class="description">This is how <b>inline elements</b> get marked up.</p>
                        </div>

                        would encode to the JsonML:

                        ["div", {"class":"section"},
                        ["p", {"class":"description"}, "This is how ", ["b", "inline elements"], " get marked up."]
                        ]

                        Optionally, you could even encode the document whitespace as well if this was significant to the original XML.

                        ["div", {"class":"section"},
                        "\r\n\t",
                        ["p", {"class":"description"}, "This is how ", ["b", "inline elements"], " get marked up."],
                        "\r\n"
                        ]

                        --- In json@yahoogroups.com, "Mark Joseph" <mark@...> wrote:
                        >
                        > Cool stuff, can you show me an example of how JsonML handles XML mixed content, that is not clear to me from the web site.
                        >
                        >
                        > And just so it is clear to me, the namespace example would be something like:
                        >
                        > <description abc="http://example.com"><abc:title>hi there</abc:title></description>
                        >
                        > becomes
                        >
                        > [ "description", {"abc" : "http://example.com"},
                        > [ "abc:title", {}, "hi there" ]
                        > ]
                        >
                        > So the JSON application has to find the meaning of "abc:title", if it cares, like XML applications do by looking for the first enclosing element with
                        > a definition for "abc"?
                        >
                        >
                        >
                        > Thanks,
                        >
                        > Mark Joseph, Ph.D.
                        > President
                        > P6R, Inc
                        > 408-205-0361
                        > mark@...
                        > Skype: markjoseph_sc
                        > _____
                        >
                        > From: stephen.mckamey [mailto:stephen@...]
                        > To: json@yahoogroups.com
                        > Sent: Tue, 06 Apr 2010 10:11:22 -0700
                        > Subject: [json] Re: Where our JSON product is heading: XML to JSON and Back
                        >
                        >
                        >
                        >
                        >
                        >
                        >
                        >
                        > JsonML ( http://jsonml.org ) handles all of these issues and has been embraced by quite a number of places. Many JSON encoders already include support.
                        >
                        > It handles namespaces the same way that XML 1.0 did: include the name as "prefix:local-name" and the URI to prefix mapping (xmlns:abc="http://example.com/abc") as the attribute of the node that declared it.
                        >
                        > An early implementation of JsonML took a similar approach to including a child object, but ultimately after some design discussions with Douglas Crockford, his suggestion was to make the actual element an array like the child object and have the element name be the first item.
                        >
                        > This positional structure has been the biggest part that people have disliked about JsonML, but yet in many XML documents (XHTML for example, being the primary use case) position of the child nodes is critical to the meaning of the document. So you get much smaller documents when you just add the element name as the first child and make elements arrays.
                        >
                        > I'd encourage you to embrace JsonML and contribute to a standard that has been around for four years already rather than creating a slightly different approach.
                        >
                        > --- In json@yahoogroups.com, "Mark Joseph" <mark@> wrote:
                        > >
                        > > For people interested in this topic. We are always open to comments and questions.
                        > >
                        > > https://www.p6r.com/articles/2010/04/05/xml-to-json-and-back/
                        > >
                        > >
                        > > Best,
                        > >
                        > > Mark Joseph, Ph.D.
                        > > President
                        > > P6R, Inc
                        > > 408-205-0361
                        > > mark@
                        > > Skype: markjoseph_sc
                        > >
                        > >
                        > >
                        > > [Non-text portions of this message have been removed]
                        > >
                        >
                        >
                        >
                        >
                        > [Non-text portions of this message have been removed]
                        >
                      • stephen.mckamey
                        Exactly. We were posting very similar examples at the same time. :)
                        Message 11 of 28 , Apr 6 11:45 AM
                        • 0 Attachment
                          Exactly. We were posting very similar examples at the same time. :)

                          --- In json@yahoogroups.com, "Mark Joseph" <mark@...> wrote:
                          >
                          > Ok I think I see how mixed content works in JsonML:
                          >
                          > <description lang="en-us"> hi there <bold>joe</bold> how are you </descrption>
                          >
                          > becomes
                          >
                          > [ "description", {"lang":"en-us"},
                          > " hi there ",
                          > [ "bold", "joe" ],
                          > " how are you "
                          > ]
                          >
                          > Is that right?
                          >
                          >
                          > Best,
                          >
                          > Mark Joseph, Ph.D.
                          > President
                          > P6R, Inc
                          > 408-205-0361
                          > mark@...
                          > Skype: markjoseph_sc
                          > _____
                          >
                          > From: stephen.mckamey [mailto:stephen@...]
                          > To: json@yahoogroups.com
                          > Sent: Tue, 06 Apr 2010 10:20:12 -0700
                          > Subject: Re: SV: [json] JSON representation for XML snippet
                          >
                          >
                          >
                          >
                          >
                          >
                          > Not that ugly:
                          >
                          > ["node1", {"a":"45"},
                          > ["node2", {"b":"9", "c":"hithere"},
                          > ["node3", {"d":"abc"},
                          > ["node4", {"e":"12345"}, "JSON has no attributes"]
                          > ]
                          > ],
                          > "Now is the time for all good men to come to the aid of their party",
                          >
                          > ["node5", {"d":"45"}, "temperature is 70 degrees today"]
                          > ]
                          >
                          > --- In json@yahoogroups.com, "Mark Joseph" <mark@> wrote:
                          > >
                          > >
                          > > Handling XML attributes when converting to JSON:
                          > > **************************************
                          > > <attribute a2="v2">value2</attribute>
                          > > will be
                          > > {"attribute":{"a2":"v2"},"#text":"value2"}
                          > >
                          > > as example ... while JSONML uses this kind of schema
                          > >
                          > > ["nodeName",{"a2":"v2"},"text or nested nodes"]
                          > >
                          > > so that this:
                          > >
                          > > <attributes>
                          > > <attribute a2="v2">value2</attribute>
                          > > </attributes>
                          > >
                          > > will be this
                          > >
                          > > ["attributes",{},["attribute",{"a2":"v2"},"value2"]]
                          > > ****************************************
                          > >
                          > > So all of the above works well when you have simple XML.
                          > > But with something like:
                          > >
                          > > <node1 a="45">
                          > > <node2 b="9" c="hithere">
                          > > <node3 d="abc">
                          > > <node4 e="12345">JSON has no attributes</node4>
                          > > </node3>
                          > > </node2>
                          > > Now is the time for all good men to come to the aid of their party
                          > >
                          > > <node5 d="45">temperature is 70 degrees today</node5>
                          > > </node1>
                          > >
                          > > The resulting JSON is going to be "ugly". Many added arrays
                          > > are added to handle the attributes and nested nodes now appear in the
                          > > added arrays. To me this adds a lot of extra complexity that I am
                          > > not sure I want.
                          > >
                          > >
                          > >
                          > > Best,
                          > > Mark Joseph, Ph.D.
                          > > P6R, Inc
                          > >
                          >
                          >
                          >
                          >
                          > [Non-text portions of this message have been removed]
                          >
                        • Fredag_d13
                          That looks pretty perfect to me. I think I will include JSONML support in the next release of my JSON api. Thanks to Mark Joseph for starting this discussion
                          Message 12 of 28 , Apr 7 1:25 AM
                          • 0 Attachment
                            That looks pretty perfect to me. I think I will include JSONML support in the next release of my JSON api.

                            Thanks to Mark Joseph for starting this discussion and thank you Stephen for the JSONML pointer.

                            I like the idea that no special characters such as @, # or stringpatterns are needed.

                            /Jonas

                            --- In json@yahoogroups.com, "stephen.mckamey" <stephen@...> wrote:
                            >
                            > Exactly. We were posting very similar examples at the same time. :)
                            >
                            > --- In json@yahoogroups.com, "Mark Joseph" <mark@> wrote:
                            > >
                            > > Ok I think I see how mixed content works in JsonML:
                            > >
                            > > <description lang="en-us"> hi there <bold>joe</bold> how are you </descrption>
                            > >
                            > > becomes
                            > >
                            > > [ "description", {"lang":"en-us"},
                            > > " hi there ",
                            > > [ "bold", "joe" ],
                            > > " how are you "
                            > > ]
                            > >
                            > > Is that right?
                            > >
                            > >
                            > > Best,
                            > >
                            > > Mark Joseph, Ph.D.
                            > > President
                            > > P6R, Inc
                            > > 408-205-0361
                            > > mark@
                            > > Skype: markjoseph_sc
                            > > _____
                            > >
                            > > From: stephen.mckamey [mailto:stephen@]
                            > > To: json@yahoogroups.com
                            > > Sent: Tue, 06 Apr 2010 10:20:12 -0700
                            > > Subject: Re: SV: [json] JSON representation for XML snippet
                            > >
                            > >
                            > >
                            > >
                            > >
                            > >
                            > > Not that ugly:
                            > >
                            > > ["node1", {"a":"45"},
                            > > ["node2", {"b":"9", "c":"hithere"},
                            > > ["node3", {"d":"abc"},
                            > > ["node4", {"e":"12345"}, "JSON has no attributes"]
                            > > ]
                            > > ],
                            > > "Now is the time for all good men to come to the aid of their party",
                            > >
                            > > ["node5", {"d":"45"}, "temperature is 70 degrees today"]
                            > > ]
                            > >
                            > > --- In json@yahoogroups.com, "Mark Joseph" <mark@> wrote:
                            > > >
                            > > >
                            > > > Handling XML attributes when converting to JSON:
                            > > > **************************************
                            > > > <attribute a2="v2">value2</attribute>
                            > > > will be
                            > > > {"attribute":{"a2":"v2"},"#text":"value2"}
                            > > >
                            > > > as example ... while JSONML uses this kind of schema
                            > > >
                            > > > ["nodeName",{"a2":"v2"},"text or nested nodes"]
                            > > >
                            > > > so that this:
                            > > >
                            > > > <attributes>
                            > > > <attribute a2="v2">value2</attribute>
                            > > > </attributes>
                            > > >
                            > > > will be this
                            > > >
                            > > > ["attributes",{},["attribute",{"a2":"v2"},"value2"]]
                            > > > ****************************************
                            > > >
                            > > > So all of the above works well when you have simple XML.
                            > > > But with something like:
                            > > >
                            > > > <node1 a="45">
                            > > > <node2 b="9" c="hithere">
                            > > > <node3 d="abc">
                            > > > <node4 e="12345">JSON has no attributes</node4>
                            > > > </node3>
                            > > > </node2>
                            > > > Now is the time for all good men to come to the aid of their party
                            > > >
                            > > > <node5 d="45">temperature is 70 degrees today</node5>
                            > > > </node1>
                            > > >
                            > > > The resulting JSON is going to be "ugly". Many added arrays
                            > > > are added to handle the attributes and nested nodes now appear in the
                            > > > added arrays. To me this adds a lot of extra complexity that I am
                            > > > not sure I want.
                            > > >
                            > > >
                            > > >
                            > > > Best,
                            > > > Mark Joseph, Ph.D.
                            > > > P6R, Inc
                            > > >
                            > >
                            > >
                            > >
                            > >
                            > > [Non-text portions of this message have been removed]
                            > >
                            >
                          • Mark Joseph
                            We have also decided to support JsonML in our next product version Sent from my iPhone ... [Non-text portions of this message have been removed]
                            Message 13 of 28 , Apr 7 4:11 AM
                            • 0 Attachment
                              We have also decided to support JsonML in
                              our next product version


                              Sent from my iPhone

                              On Apr 7, 2010, at 1:29 AM, "Fredag_d13" <jonas@...> wrote:

                              > That looks pretty perfect to me. I think I will include JSONML
                              > support in the next release of my JSON api.
                              >
                              > Thanks to Mark Joseph for starting this discussion and thank you
                              > Stephen for the JSONML pointer.
                              >
                              > I like the idea that no special characters such as @, # or
                              > stringpatterns are needed.
                              >
                              > /Jonas
                              >
                              > --- In json@yahoogroups.com, "stephen.mckamey" <stephen@...> wrote:
                              > >
                              > > Exactly. We were posting very similar examples at the same time. :)
                              > >
                              > > --- In json@yahoogroups.com, "Mark Joseph" <mark@> wrote:
                              > > >
                              > > > Ok I think I see how mixed content works in JsonML:
                              > > >
                              > > > <description lang="en-us"> hi there <bold>joe</bold> how are you
                              > </descrption>
                              > > >
                              > > > becomes
                              > > >
                              > > > [ "description", {"lang":"en-us"},
                              > > > " hi there ",
                              > > > [ "bold", "joe" ],
                              > > > " how are you "
                              > > > ]
                              > > >
                              > > > Is that right?
                              > > >
                              > > >
                              > > > Best,
                              > > >
                              > > > Mark Joseph, Ph.D.
                              > > > President
                              > > > P6R, Inc
                              > > > 408-205-0361
                              > > > mark@
                              > > > Skype: markjoseph_sc
                              > > > _____
                              > > >
                              > > > From: stephen.mckamey [mailto:stephen@]
                              > > > To: json@yahoogroups.com
                              > > > Sent: Tue, 06 Apr 2010 10:20:12 -0700
                              > > > Subject: Re: SV: [json] JSON representation for XML snippet
                              > > >
                              > > >
                              > > >
                              > > >
                              > > >
                              > > >
                              > > > Not that ugly:
                              > > >
                              > > > ["node1", {"a":"45"},
                              > > > ["node2", {"b":"9", "c":"hithere"},
                              > > > ["node3", {"d":"abc"},
                              > > > ["node4", {"e":"12345"}, "JSON has no attributes"]
                              > > > ]
                              > > > ],
                              > > > "Now is the time for all good men to come to the aid of their
                              > party",
                              > > >
                              > > > ["node5", {"d":"45"}, "temperature is 70 degrees today"]
                              > > > ]
                              > > >
                              > > > --- In json@yahoogroups.com, "Mark Joseph" <mark@> wrote:
                              > > > >
                              > > > >
                              > > > > Handling XML attributes when converting to JSON:
                              > > > > **************************************
                              > > > > <attribute a2="v2">value2</attribute>
                              > > > > will be
                              > > > > {"attribute":{"a2":"v2"},"#text":"value2"}
                              > > > >
                              > > > > as example ... while JSONML uses this kind of schema
                              > > > >
                              > > > > ["nodeName",{"a2":"v2"},"text or nested nodes"]
                              > > > >
                              > > > > so that this:
                              > > > >
                              > > > > <attributes>
                              > > > > <attribute a2="v2">value2</attribute>
                              > > > > </attributes>
                              > > > >
                              > > > > will be this
                              > > > >
                              > > > > ["attributes",{},["attribute",{"a2":"v2"},"value2"]]
                              > > > > ****************************************
                              > > > >
                              > > > > So all of the above works well when you have simple XML.
                              > > > > But with something like:
                              > > > >
                              > > > > <node1 a="45">
                              > > > > <node2 b="9" c="hithere">
                              > > > > <node3 d="abc">
                              > > > > <node4 e="12345">JSON has no attributes</node4>
                              > > > > </node3>
                              > > > > </node2>
                              > > > > Now is the time for all good men to come to the aid of their
                              > party
                              > > > >
                              > > > > <node5 d="45">temperature is 70 degrees today</node5>
                              > > > > </node1>
                              > > > >
                              > > > > The resulting JSON is going to be "ugly". Many added arrays
                              > > > > are added to handle the attributes and nested nodes now appear
                              > in the
                              > > > > added arrays. To me this adds a lot of extra complexity that I
                              > am
                              > > > > not sure I want.
                              > > > >
                              > > > >
                              > > > >
                              > > > > Best,
                              > > > > Mark Joseph, Ph.D.
                              > > > > P6R, Inc
                              > > > >
                              > > >
                              > > >
                              > > >
                              > > >
                              > > > [Non-text portions of this message have been removed]
                              > > >
                              > >
                              >
                              >


                              [Non-text portions of this message have been removed]
                            Your message has been successfully submitted and would be delivered to recipients shortly.