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

Re: XML convert to JSON

Expand Messages
  • Douglas Crockford
    ... This is one possible way: { CrossPromotion : { ItemID : 4504618045, PrimaryScheme : StoreToStoreCat , PromotionMethod : UpSell , SellerID :
    Message 1 of 3 , Feb 11, 2006
    • 0 Attachment
      --- In json@yahoogroups.com, "diccsy" <diccsy@...> wrote:

      > I have an XML file :
      > <CrossPromotion>
      > <ItemID>4504618045</ItemID>
      > <PrimaryScheme>StoreToStoreCat</PrimaryScheme>
      > <PromotionMethod>UpSell</PromotionMethod>
      > <SellerID>joe_healthcheck_0310</SellerID>
      > <ShippingDiscount>false</ShippingDiscount>
      > <SellerKey>0</SellerKey>
      > <PromotedItem>
      > <ItemID>4504329237</ItemID>
      > <position>1</position>
      > <PromotionPrice currencyID="EUR">100000</PromotionPrice>
      > <PromotionPriceType>CustomCode</PromotionPriceType>
      > <SelectionType>Automatic</SelectionType>
      > <Title>Test Real Estate Ad Title</Title>
      > <ListingType>AdType</ListingType>
      > </PromotedItem>
      > <PromotedItem>
      > <ItemID>4504329239</ItemID>
      > <position>2</position>
      > <PromotionPrice currencyID="USD">100000</PromotionPrice>
      > <PromotionPriceType>CustomCode</PromotionPriceType>
      > <SelectionType>Automatic</SelectionType>
      > <Title>Test Real Estate Ad Title</Title>
      > <ListingType>AdType</ListingType>
      > </PromotedItem>
      > <CrossPromotion>
      > how can i put this an JSON object?

      This is one possible way:

      {
      "CrossPromotion": {
      "ItemID": 4504618045,
      "PrimaryScheme": "StoreToStoreCat",
      "PromotionMethod": "UpSell",
      "SellerID": "joe_healthcheck_0310",
      "ShippingDiscount": false,
      "PromotedItem": [
      {
      "ItemID": 4504329237,
      "position": 1,
      "PromotionPrice": {
      "currencyID": "EUR",
      "content": 100000
      },
      "PromotionPriceType": "CustomCode",
      "SelectionType": "Automatic",
      "Title": "Test Real Estate Ad Title",
      "ListingType": "AdType"
      }, {
      "ItemID": 4504329239,
      "position": 2,
      "PromotionPrice": {
      "currencyID": "EUR",
      "content": 100000
      },
      "PromotionPriceType": "CustomCode",
      "SelectionType": "Automatic",
      "Title": "Test Real Estate Ad Title",
      "ListingType": "AdType"
      }
      ]
      }
      }

      Transformations like this can be done automatically with the Java
      class org.json.XML.
    • diccsy diccsy
      Hi, ok i understand thet output, but how can i make this? JSON have a function, which receive one XMLReader object and result is an JSON object? ... This is
      Message 2 of 3 , Feb 11, 2006
      • 0 Attachment
        Hi,
        ok i understand thet output, but how can i make this? JSON have a function, which receive one XMLReader object and result is an JSON object?

        Douglas Crockford <douglas@...> wrote: --- In json@yahoogroups.com, "diccsy" <diccsy@...> wrote:

        > I have an XML file :
        > <CrossPromotion>
        > <ItemID>4504618045</ItemID>
        > <PrimaryScheme>StoreToStoreCat</PrimaryScheme>
        > <PromotionMethod>UpSell</PromotionMethod>
        > <SellerID>joe_healthcheck_0310</SellerID>
        > <ShippingDiscount>false</ShippingDiscount>
        > <SellerKey>0</SellerKey>
        > <PromotedItem>
        > <ItemID>4504329237</ItemID>
        > <position>1</position>
        > <PromotionPrice currencyID="EUR">100000</PromotionPrice>
        > <PromotionPriceType>CustomCode</PromotionPriceType>
        > <SelectionType>Automatic</SelectionType>
        > <Title>Test Real Estate Ad Title</Title>
        > <ListingType>AdType</ListingType>
        > </PromotedItem>
        > <PromotedItem>
        > <ItemID>4504329239</ItemID>
        > <position>2</position>
        > <PromotionPrice currencyID="USD">100000</PromotionPrice>
        > <PromotionPriceType>CustomCode</PromotionPriceType>
        > <SelectionType>Automatic</SelectionType>
        > <Title>Test Real Estate Ad Title</Title>
        > <ListingType>AdType</ListingType>
        > </PromotedItem>
        > <CrossPromotion>
        > how can i put this an JSON object?

        This is one possible way:

        {
        "CrossPromotion": {
        "ItemID": 4504618045,
        "PrimaryScheme": "StoreToStoreCat",
        "PromotionMethod": "UpSell",
        "SellerID": "joe_healthcheck_0310",
        "ShippingDiscount": false,
        "PromotedItem": [
        {
        "ItemID": 4504329237,
        "position": 1,
        "PromotionPrice": {
        "currencyID": "EUR",
        "content": 100000
        },
        "PromotionPriceType": "CustomCode",
        "SelectionType": "Automatic",
        "Title": "Test Real Estate Ad Title",
        "ListingType": "AdType"
        }, {
        "ItemID": 4504329239,
        "position": 2,
        "PromotionPrice": {
        "currencyID": "EUR",
        "content": 100000
        },
        "PromotionPriceType": "CustomCode",
        "SelectionType": "Automatic",
        "Title": "Test Real Estate Ad Title",
        "ListingType": "AdType"
        }
        ]
        }
        }

        Transformations like this can be done automatically with the Java
        class org.json.XML.





        SPONSORED LINKS
        Json Programming languages Format Computer security Computer training Large format

        ---------------------------------
        YAHOO! GROUPS LINKS


        Visit your group "json" on the web.

        To unsubscribe from this group, send an email to:
        json-unsubscribe@yahoogroups.com

        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


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





        ---------------------------------
        Find your next car at Yahoo! Canada Autos

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