json issues

I am using the temboo api with amazon calls… I am trying to get the json response for the price of a supplied item(by ASIN)
this is what I am getting as a response:

{"output":{"Response":"{\"@xmlns\":\"http:\\/\\/mws.amazonservices.com\\/schema\\/Products\\/2011-10-01\",\"GetMatchingProductResult\":{\"@ASIN\":\"B005DLDO4U\",\"@status\":\"Success\",\"Product\":{\"@xmlns:ns2\":\"http:\\/\\/mws.amazonservices.com\\/schema\\/Products\\/2011-10-01\\/default.xsd\",\"Identifiers\":{\"MarketplaceASIN\":{\"MarketplaceId\":\"ATVPDKIKX0DER\",\"ASIN\":\"B005DLDO4U\"}},\"AttributeSets\":{\"ns2:ItemAttributes\":{\"@xmlns:ns2\":\"http:\\/\\/mws.amazonservices.com\\/schema\\/Products\\/2011-10-01\\/default.xsd\",\"@xml:lang\":\"en-US\",\"ns2:Binding\":\"Personal Computers\",\"ns2:Brand\":\"Apple\",\"ns2:Color\":\"Silver\",\"ns2:CPUType\":\"intel_atom\",\"ns2:DisplaySize\":{\"@Units\":\"inches\",\"#text\":\"7\"},\"ns2:Feature\":[\"Apple Battery Charger:Get the ultimate power supply for your wireless Mac accessories.\",\"Easy on the eyes. And hands:you?ll see that it takes up far less space ? up to 24 percent less ? than other full-size keyboards.\",\"The Bluetooth connection. Your Mac works with the Apple Wireless Keyboard through the Bluetooth technology built into both.\",\"One less battery. All the difference:The Apple Wireless Keyboard now requires just two AA batteries ? one less than the previous model.\"],\"ns2:HandOrientation\":\"ambidextrous\",\"ns2:HardDiskSize\":{\"@Units\":\"GB\",\"#text\":\"64\"},\"ns2:HardwarePlatform\":\"mac\",\"ns2:ItemDimensions\":{\"ns2:Height\":{\"@Units\":\"inches\",\"#text\":\"7.30\"},\"ns2:Length\":{\"@Units\":\"inches\",\"#text\":\"12.80\"},\"ns2:Width\":{\"@Units\":\"inches\",\"#text\":\"1.40\"},\"ns2:Weight\":{\"@Units\":\"pounds\",\"#text\":\"0.50\"}},\"ns2:Label\":\"Apple Computer\",\"ns2:ListPrice\":{\"ns2:Amount\":\"69.00\",\"ns2:CurrencyCode\":\"USD\"},\"ns2:Manufacturer\":\"Apple Computer\",\"ns2:MaterialType\":\"Aluminum\",\"ns2:Model\":\"MC184LL\\/B\",\"ns2:NumberOfItems\":\"1\",\"ns2:OperatingSystem\":\"other\",\"ns2:PackageDimensions\":{\"ns2:Height\":{\"@Units\":\"inches\",\"#text\":\"1.20\"},\"ns2:Length\":{\"@Units\":\"inches\",\"#text\":\"12.50\"},\"ns2:Width\":{\"@Units\":\"inches\",\"#text\":\"5.40\"},\"ns2:Weight\":{\"@Units\":\"pounds\",\"#text\":\"0.70\"}},\"ns2:PackageQuantity\":\"10\",\"ns2:PartNumber\":\"MC184LL\\/B\",\"ns2:ProductGroup\":\"CE\",\"ns2:ProductTypeName\":\"KEYBOARDS\",\"ns2:Publisher\":\"Apple Computer\",\"ns2:SmallImage\":{\"ns2:URL\":\"http:\\/\\/ecx.images-amazon.com\\/images\\/I\\/21kxmYXoMTL._SL75_.jpg\",\"ns2:Height\":{\"@Units\":\"pixels\",\"#text\":\"31\"},\"ns2:Width\":{\"@Units\":\"pixels\",\"#text\":\"75\"}},\"ns2:Studio\":\"Apple Computer\",\"ns2:Title\":\"Apple Wireless Keyboard MC184LL\\/B\"}},\"Relationships\":null,\"SalesRankings\":{\"SalesRank\":{\"ProductCategoryId\":\"12879431\",\"Rank\":\"4\"}}}},\"ResponseMetadata\":{\"RequestId\":\"9bf9ce5f-f071-4798-b6e5-7a6c3a092097\"}}"},"truncatedItems":[],"execution":{"endtime":"1402856871357","id":"8a38141f46726c330146a0c913f63eb1","starttime":"1402856870922","status":"SUCCESS"}}

Usually json doesnt return with all the slashes… not sure what i am doing wrong here…
here is my code:

[code]
https.SetRequestHeader(“x-temboo-domain”, “/” + userName + “/master”)
https.SetRequestHeader(“Content-Type”, “application/json”)
https.SetRequestHeader(“Accept”, “application/json”)
https.SetRequestHeader(“Authorization”, "Basic " + EncodeBase64(tempBasicAuth)) ’ Base64 the AppName:AppKey

dim js as string = “{”“preset”":"“amazonGetMatchingProduct”", ““inputs””: [ {"“name”":"“ASIN”", ““value””:"""+ASIN+"""}, {"“name”":"“ResponseFormat”", ““value””:"“json”"}]}"
https.SetRequestContent(js, “application/json”)

// Send Temboo Request
response = https.Post(Join(url, “”), 30)[/code]

Anyone know how to resolve this? or at least get the ns2:ListPrice from the response? I keep getting keynotfound or exception

Someone is stuffing a JSON string into the Response property as a string instead of as an object. If you pull the value of Response and create a new jsonitem from that, you’ll be fine.

Your current JSON is like this:

{
    "output”:”{ here is a JSON string needing scape chars to avoid internal closing double quotes }”,
    "truncatedItems":{
    },
    "execution":{
        "endtime":"1402856871357",
        "id":"8a38141f46726c330146a0c913f63eb1",
        "starttime":"1402856870922",
        "status":"SUCCESS"
    }

}
  Dim apiResponse As New JSONItem(response)
  Dim results As JSONItem = apiResponse.Value("output")

I am putting the response into a new jsonitem. not sure what i am doing wrong here

According to the temboo api this is the response i should receive:

{"@xmlns":"http://mws.amazonservices.com/schema/Products/2011-10-01","GetMatchingProductResult":{"@ASIN":"B005DLDO4U","@status":"Success","Product":{"@xmlns:ns2":"http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd","Identifiers":{"MarketplaceASIN":{"MarketplaceId":"ATVPDKIKX0DER","ASIN":"B005DLDO4U"}},"AttributeSets":{"ns2:ItemAttributes":{"@xmlns:ns2":"http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd","@xml:lang":"en-US","ns2:Binding":"Personal Computers","ns2:Brand":"Apple","ns2:Color":"Silver","ns2:CPUType":"intel_atom","ns2:DisplaySize":{"@Units":"inches","#text":"7"},"ns2:Feature":["Apple Battery Charger:Get the ultimate power supply for your wireless Mac accessories.","Easy on the eyes. And hands:you?ll see that it takes up far less space ? up to 24 percent less ? than other full-size keyboards.","The Bluetooth connection. Your Mac works with the Apple Wireless Keyboard through the Bluetooth technology built into both.","One less battery. All the difference:The Apple Wireless Keyboard now requires just two AA batteries ? one less than the previous model."],"ns2:HandOrientation":"ambidextrous","ns2:HardDiskSize":{"@Units":"GB","#text":"64"},"ns2:HardwarePlatform":"mac","ns2:ItemDimensions":{"ns2:Height":{"@Units":"inches","#text":"7.30"},"ns2:Length":{"@Units":"inches","#text":"12.80"},"ns2:Width":{"@Units":"inches","#text":"1.40"},"ns2:Weight":{"@Units":"pounds","#text":"0.50"}},"ns2:Label":"Apple Computer","ns2:ListPrice":{"ns2:Amount":"69.00","ns2:CurrencyCode":"USD"},"ns2:Manufacturer":"Apple Computer","ns2:MaterialType":"Aluminum","ns2:Model":"MC184LL/B","ns2:NumberOfItems":"1","ns2:OperatingSystem":"other","ns2:PackageDimensions":{"ns2:Height":{"@Units":"inches","#text":"1.20"},"ns2:Length":{"@Units":"inches","#text":"12.50"},"ns2:Width":{"@Units":"inches","#text":"5.40"},"ns2:Weight":{"@Units":"pounds","#text":"0.70"}},"ns2:PackageQuantity":"10","ns2:PartNumber":"MC184LL/B","ns2:ProductGroup":"CE","ns2:ProductTypeName":"KEYBOARDS","ns2:Publisher":"Apple Computer","ns2:SmallImage":{"ns2:URL":"http://ecx.images-amazon.com/images/I/21kxmYXoMTL._SL75_.jpg","ns2:Height":{"@Units":"pixels","#text":"31"},"ns2:Width":{"@Units":"pixels","#text":"75"}},"ns2:Studio":"Apple Computer","ns2:Title":"Apple Wireless Keyboard MC184LL/B"}},"Relationships":null,"SalesRankings":{"SalesRank":{"ProductCategoryId":"12879431","Rank":"4"}}}},"ResponseMetadata":{"RequestId":"23c3e963-6861-4db2-85b5-19db99fe3ff6"}}

Try this

Dim apiResponse As New JSONItem(response) // extract the actual response Response = apiResponse.Child("output").Value("Response") Dim results as New JSONItem(Response)

Now you should be able to access the parts you need.

Fwiw, it looks like they’ve employed a poor man’s translation for XML to JSON. All of that @xmlns stuff is from an XML namespace.