I need to parse this JSON in JavaScript or jQuery. Please help me in getting the list of product in the below JSON.
To get the list of product
{
"main": {
"ProductsData": {
"Product": {
"AdjustmentTypeID": "0",
"BrandID": "4",
"BrandName": "Joseph Joseph",
"ChildrenGenerated": "False",
"Cost": "8.50",
"Description": "The ingenious dual-chamber design of this measuring jug eliminates the need for separate measuring spoons, cups and jugs. Use the small chamber to accurately measure liquids from as little as a single teaspoon (5ml), and then for greater volumes (up to 550ml) simply turn the jug 180º and use the larger chamber. Made from SAN material. Heat resistant to 90°C \\/ 190°F.<\\/span>\\u000d\\u000a
\\u000d\\u000aDesign registered<\\/o:p><\\/span><\\/p>\\u000d\\u000a
\\u000d\\u000aDimensions 7x 7 x 15cm<\\/o:p><\\/span><\\/p>",
"DownloadFile": "",
"InternalCode": "502842009381 0",
"IsProductActive": "False",
"ManufacturerID": "11",
"ManufacturerName": "Joseph Joseph",
"OptionMatchGroupID": "",
"ParentProduct": "",
"ProductID": "80",
"ProductName": "2-in-1 Measuring Jug",
"ProductTypeDescription": "Compound Product",
"ProductTypeID": "8",
"SiteID": "57",
"StockLevel": "",
"SupplierID": "3",
"SupplierName": "Joseph Joseph",
"UseStockControl": "False",
"VatRate": "20"
}
}
}
}
Answer
Use the parseJSON
method in jQuery.
Example:
var obj = $.parseJSON(yourJsonString);
alert(obj.main.ProductsData.Product.Cost);
No comments:
Post a Comment