I would need to parse some data that i get from JSON query. I get the data with
$.getJSON(JSONquery, function(data){
$.each(data, function(i,item){
$('#output....
});
The data I get from it something like this (sorry its messy and longish):
[{"name":"139930 blablabla","id":599,"contentobject_id":599,"main_node_id":565,"modified":"1287146683","published":"1264417592","section_id":1,"current_language":"eng","owner_id":193,"class_id":28,"class_name":"Product","class_identifier":"product","is_container":0,"node_id":565,"parent_node_id":355,"url_alias":"Products\/blablabla\/blablabla\/139930-blablabla","depth":6,"path":false,"children_count":false,"image_attributes":["main_image","listing_thumbnail","promo_badge"],"data_map":{"title":{"id":"6488","type":"ezstring","identifier":"title","content":"blablabla"},"short_title":{"id":"6489","type":"ezstring","identifier":"short_title","content":"139930 blablabla"},"subtitle":{"id":"6490","type":"ezstring","identifier":"subtitle","content":""},"authors":{"id":"6491","type":"ezauthor","identifier":"authors","content":"blablabla blablabla | blablabla@ blablabla .com|0"},"keywords":{"id":"6492","type":"ezkeyword","identifier":"keywords","content":"blablabla"},"item_id":{"id":"6493","type":"ezstring","identifier":"item_id","content":"139930"},"price":{"id":"6494","type":"ezprice","identifier":"price","content":"0|1|1"},"is_shoppable":{"id":"6495","type":"ezboolean","identifier":"is_shoppable","content":"0"},"main_image":{"id":"6496","type":"ezimage","identifier":"main_image","content":{"reference":false,"small":{"name":"small","width":"100","height":"33","mime_type":"image\/jpeg","filename":"139930-blablabla_small.jpg","suffix":"jpg","dirpath":"var\/blablabal_blablabal\/storage\/images\/frontpage\/products\/lawn-blablabla\/blablabla\/139930-blablabla\/6496-25-eng-EU","alias_key":"2343348577","timestamp":"1286700665","is_valid":"1","url":"var\/blablabla\/storage\/images\/frontpage\/products\/blablabla-care\/blablabla\/139930-blablabla/6496-25-eng-EU\/139930-blablabla-blablablar_small.jpg","basename":"139930-blablabla-blablablar","alternative_text":"","text":"","original_filename":"139930_2.jpg","full_path":"var\/blablabal_blablabal\/storage\/images\/frontpage\/products\/blab-bla\/blaaders\/139930-blablabla-blablablar\/6496-25-eng-EU\/139930-blablabla-blablablar_small.jpg","is_new":false,"info":{"Height":"200","Width":"600","IsColor":"1"}},"tiny":false,"medium":false,"large":false,"rss":false,"width100":false,"width150":false,"width200":false,"width300":false,"width400":false,"product_main":false,"product_main_large":false,"product_listing":false,"product_category_listing":false,"product_media_listing":false,"rc_full":false,"main_banner":false,"main_banner_front":false,"promo_badge":false,"multiuploadthumbnail":false,"original":{"url":"var\/blablabal_blablabal\/storage\/images\/frontpage\/products\/blab-bla\/blaaders\/139930-blablabla-blablablar\/6496-25-eng-EU\/139930-blablabla-blablablar.jpg|"}}},"listing_thumbnail":{"id":"6497","type":"ezimage","identifier":"listing_thumbnail","content":{"reference":false,"small":null,"tiny":false,"medium":false,"large":false,"rss":false,"width100":false,"width150":false,"width200":false,"width300":false,"width400":false,"product_main":false,"product_main_large":false,"product_listing":false,"product_category_listing":false,"product_media_listing":false,"rc_full":false,"main_banner":false,"main_banner_front":false,"promo_badge":false,"multiuploadthumbnail":false,"original":{"url":"var\/blablabal_blablabal\/storage\/images\/frontpage\/products\/blab-bla\/blaaders\/139930-blablabla-blablablar\/6497-25-eng-EU\/139930-blablabla-blablablar.jpg|"}}},"related_images":{"id":"6498","type":"ezobjectrelationbrowse","identifier":"related_images","content":"605"},"related_media":{"id":"6499","type":"ezobjectrelationbrowse","identifier":"related_media","content":""},"related_products":{"id":"6500","type":"ezobjectrelationbrowse","identifier":"related_products","content":""},"related_faq_items":{"id":"6501","type":"ezobjectrelationbrowse","identifier":"related_faq_items","content":""},"awards":{"id":"6502","type":"ezxmltext","identifier":"awards","content":"\n
\n"},"country_awards":{"id":"601924","type":"ezxmltext","identifier":"country_awards","content":"\n
\n"},"description":{"id":"6503","type":"ezxmltext","identifier":"description","content":"\n
blablabla<\/line><\/paragraph><\/section>\n"},"features":{"id":"6504","type":"ezxmltext","identifier":"features","content":"\n
• blablabla <\/paragraph><\/li>
• blablabla <\/paragraph><\/li>
• blablabla <\/paragraph><\/li>
• blablabla <\/paragraph><\/li>
• C blablabla <\/paragraph><\/li><\/ul><\/paragraph><\/section>\n"},"freeform_1_title":{"id":"6505","type":"ezstring","identifier":"freeform_1_title","content":""},"freeform_1_content":{"id":"6506","type":"ezxmltext","identifier":"freeform_1_content","content":"\n\n"},"freeform_2_title":{"id":"6507","type":"ezstring","identifier":"freeform_2_title","content":""},"freeform_2_content":{"id":"6508","type":"ezxmltext","identifier":"freeform_2_content","content":"\n\n"},"freeform_3_title":{"id":"6509","type":"ezstring","identifier":"freeform_3_title","content":""},"freeform_3_content":{"id":"6510","type":"ezxmltext","identifier":"freeform_3_content","content":"\n\n"},"promo_badge":{"id":"277833","type":"ezimage","identifier":"promo_badge","content":{"reference":false,"small":null,"tiny":false,"medium":false,"large":false,"rss":false,"width100":false,"width150":false,"width200":false,"width300":false,"width400":false,"product_main":false,"product_main_large":false,"product_listing":false,"product_category_listing":false,"product_media_listing":false,"rc_full":false,"main_banner":false,"main_banner_front":false,"promo_badge":false,"multiuploadthumbnail":false,"original":{"url":"|"}}},"weight":{"id":"433850","type":"ezstring","identifier":"weight","content":"1052"},"length":{"id":"433851","type":"ezstring","identifier":"length","content":"970"},"product_attributes":{"id":"691877","type":"blamatrix","identifier":"product_attributes","content":{"HTTPValue":null,"Content":null,"DisplayInfo":null,"IsValid":null,"ContentClassAttributeID":"891","ValidationError":null,"ValidationLog":null,"ContentClassAttributeIdentifier":"product_attributes","ContentClassAttributeCanTranslate":null,"ContentClassAttributeName":null,"ContentClassAttributeIsInformationCollector":null,"ContentClassAttributeIsRequired":null,"PersistentDataDirty":false,"InputParameters":false,"HasValidationError":false,"DataTypeCustom":null,"ID":"691877","ContentObjectID":"599","Version":"26","LanguageCode":"eng-EU","LanguageID":"8","AttributeOriginalID":"0","SortKeyInt":"0","SortKeyString":"","DataTypeString":"blamatrix","DataText":"\n<\/name>Title<\/column>Content<\/column><\/columns>Description<\/c><ul><li>I NEED THIS DESC TEXT<\/li><\/ul><\/c>SOME TITLE<\/c><ul><li>THIS TEXT<\/li><\/ul><\/c>THIS TITLE<\/c>THIS TEXT<\/c>THIS TITLE<\/c>AGAIN THIS TEXT<\/c>THIS TITLE<\/c><ul><li>THIS TEXAT<\/li><\/ul><\/c>THIS TITLE<\/c><ul><li>THIS TEXT<\/li><\/ul><\/c>YEP THIS TITLE<\/c>THIS<\/c><\/blamatrix>\n","DataInt":null,"DataFloat":"0"}}}}]
I would need to get those 'THIS TEXT/TITLE' parts and append them inot a table. Here a cut from that huge output (so this part i would need to parse):
{
"id": "691877",
"type": "blamatrix",
"identifier": "product_attributes",
"content": {
"HTTPValue": null,
"Content": null,
"DisplayInfo": null,
"IsValid": null,
"ContentClassAttributeID": "891",
"ValidationError": null,
"ValidationLog": null,
"ContentClassAttributeIdentifier": "product_attributes",
"ContentClassAttributeCanTranslate": null,
"ContentClassAttributeName": null,
"ContentClassAttributeIsInformationCollector": null,
"ContentClassAttributeIsRequired": null,
"PersistentDataDirty": false,
"InputParameters": false,
"HasValidationError": false,
"DataTypeCustom": null,
"ID": "691877",
"ContentObjectID": "599",
"Version": "26",
"LanguageCode": "eng-EU",
"LanguageID": "8",
"AttributeOriginalID": "0",
"SortKeyInt": "0",
"SortKeyString": "",
"DataTypeString": "blamatrix",
"DataText": "\n<\/name>Title<\/column>Content<\/column><\/columns>Description<\/c><ul><li>I NEED THIS DESC TEXT<\/li><\/ul><\/c>SOME TITLE<\/c><ul><li>THIS TEXT<\/li><\/ul><\/c>THIS TITLE<\/c>THIS TEXT<\/c>THIS TITLE<\/c>AGAIN THIS TEXT<\/c>THIS TITLE<\/c><ul><li>THIS TEXAT<\/li><\/ul><\/c>THIS TITLE<\/c><ul><li>THIS TEXT<\/li><\/ul><\/c>YEP THIS TITLE<\/c>THIS<\/c><\/blamatrix>\n",
"DataInt": null,
"DataFloat": "0"
}
}
Here is the content of that DataText attribute that I would need to parse:
<blamatrixrix>
<name></name>
<columns number="2">
<column id="title" num="0">Title</column>
<column id="content" num="1">Content</column>
</columns>
<rows number="7"></rows>
<c>Description</c>
<c><ul><li>Description text here</li></ul></c>
<c>Some title</c>
<c>Some text blabla</c>
<c>Some title</c>
<c>Some text blabla</c>
<c>Some title</c>
<c>Some text blabla</c>
<c>Some title</c>
<c>Some text blabla</c>
<c>Some title</c>
<c>Some text blabla</c>
<c>Some title</c>
<c>Some text blabla</c>
</blamatrixrix>
So titles to own and some texts to own . Im still not sure how to parse inside of that :(
some of your data is not valid juston where you have line breaks that might be due to how you copied and pasted but I cleaned it up here is what you need
var data = [{
"name": "139930 blablabla",
"id": 599,
"contentobject_id": 599,
"main_node_id": 565,
"modified": "1287146683",
"published": "1264417592",
"section_id": 1,
"current_language": "eng",
"owner_id": 193,
"class_id": 28,
"class_name": "Product",
"class_identifier": "product",
"is_container": 0,
"node_id": 565,
"parent_node_id": 355,
"url_alias": "Products\/blablabla\/blablabla\/139930-blablabla",
"depth": 6,
"path": false,
"children_count": false,
"image_attributes": ["main_image", "listing_thumbnail", "promo_badge"],
"data_map": {
"title": {
"id": "6488",
"type": "ezstring",
"identifier": "title",
"content": "blablabla"
},
"short_title": {
"id": "6489",
"type": "ezstring",
"identifier": "short_title",
"content": "139930 blablabla"
},
"subtitle": {
"id": "6490",
"type": "ezstring",
"identifier": "subtitle",
"content": ""
},
"authors": {
"id": "6491",
"type": "ezauthor",
"identifier": "authors",
"content": "blablabla blablabla | blablabla@ blablabla .com|0"
},
"keywords": {
"id": "6492",
"type": "ezkeyword",
"identifier": "keywords",
"content": "blablabla"
},
"item_id": {
"id": "6493",
"type": "ezstring",
"identifier": "item_id",
"content": "139930"
},
"price": {
"id": "6494",
"type": "ezprice",
"identifier": "price",
"content": "0|1|1"
},
"is_shoppable": {
"id": "6495",
"type": "ezboolean",
"identifier": "is_shoppable",
"content": "0"
},
"main_image": {
"id": "6496",
"type": "ezimage",
"identifier": "main_image",
"content": {
"reference": false,
"small": {
"name": "small",
"width": "100",
"height": "33",
"mime_type": "image\/jpeg",
"filename": "139930-blablabla_small.jpg",
"suffix": "jpg",
"dirpath": "var\/blablabal_blablabal\/storage\/images\/frontpage\/products\/lawn-blablabla\/blablabla\/139930-blablabla\/6496-25-eng-EU",
"alias_key": "2343348577",
"timestamp": "1286700665",
"is_valid": "1",
"url": "var\/blablabla\/storage\/images\/frontpage\/products\/blablabla-care\/blablabla\/139930-blablabla/6496-25-eng-EU\/139930-blablabla-blablablar_small.jpg",
"basename": "139930-blablabla-blablablar",
"alternative_text": "",
"text": "",
"original_filename": "139930_2.jpg",
"full_path": "var\/blablabal_blablabal\/storage\/images\/frontpage\/products\/blab-bla\/blaaders\/139930-blablabla-blablablar\/6496-25-eng-EU\/139930-blablabla-blablablar_small.jpg",
"is_new": false,
"info": {
"Height": "200",
"Width": "600",
"IsColor": "1"
}
},
"tiny": false,
"medium": false,
"large": false,
"rss": false,
"width100": false,
"width150": false,
"width200": false,
"width300": false,
"width400": false,
"product_main": false,
"product_main_large": false,
"product_listing": false,
"product_category_listing": false,
"product_media_listing": false,
"rc_full": false,
"main_banner": false,
"main_banner_front": false,
"promo_badge": false,
"multiuploadthumbnail": false,
"original": {
"url": "var\/blablabal_blablabal\/storage\/images\/frontpage\/products\/blab-bla\/blaaders\/139930-blablabla-blablablar\/6496-25-eng-EU\/139930-blablabla-blablablar.jpg|"
}
}
},
"listing_thumbnail": {
"id": "6497",
"type": "ezimage",
"identifier": "listing_thumbnail",
"content": {
"reference": false,
"small": null,
"tiny": false,
"medium": false,
"large": false,
"rss": false,
"width100": false,
"width150": false,
"width200": false,
"width300": false,
"width400": false,
"product_main": false,
"product_main_large": false,
"product_listing": false,
"product_category_listing": false,
"product_media_listing": false,
"rc_full": false,
"main_banner": false,
"main_banner_front": false,
"promo_badge": false,
"multiuploadthumbnail": false,
"original": {
"url": "var\/blablabal_blablabal\/storage\/images\/frontpage\/products\/blab-bla\/blaaders\/139930-blablabla-blablablar\/6497-25-eng-EU\/139930-blablabla-blablablar.jpg|"
}
}
},
"related_images": {
"id": "6498",
"type": "ezobjectrelationbrowse",
"identifier": "related_images",
"content": "605"
},
"related_media": {
"id": "6499",
"type": "ezobjectrelationbrowse",
"identifier": "related_media",
"content": ""
},
"related_products": {
"id": "6500",
"type": "ezobjectrelationbrowse",
"identifier": "related_products",
"content": ""
},
"related_faq_items": {
"id": "6501",
"type": "ezobjectrelationbrowse",
"identifier": "related_faq_items",
"content": ""
},
"awards": {
"id": "6502",
"type": "ezxmltext",
"identifier": "awards",
"content": "\n\n"
},
"country_awards": {
"id": "601924",
"type": "ezxmltext",
"identifier": "country_awards",
"content": "\n\n"
},
"description": {
"id": "6503",
"type": "ezxmltext",
"identifier": "description",
"content": "\nblablabla<\/line><\/paragraph><\/section>\n"
},
"features": {
"id": "6504",
"type": "ezxmltext",
"identifier": "features",
"content": "\n• blablabla <\/paragraph><\/li>• blablabla <\/paragraph><\/li>• blablabla <\/paragraph><\/li>• blablabla <\/paragraph><\/li>• C blablabla <\/paragraph><\/li><\/ul><\/paragraph><\/section>\n"
},
"freeform_1_title": {
"id": "6505",
"type": "ezstring",
"identifier": "freeform_1_title",
"content": ""
},
"freeform_1_content": {
"id": "6506",
"type": "ezxmltext",
"identifier": "freeform_1_content",
"content": "\n\n"
},
"freeform_2_title": {
"id": "6507",
"type": "ezstring",
"identifier": "freeform_2_title",
"content": ""
},
"freeform_2_content": {
"id": "6508",
"type": "ezxmltext",
"identifier": "freeform_2_content",
"content": "\n\n"
},
"freeform_3_title": {
"id": "6509",
"type": "ezstring",
"identifier": "freeform_3_title",
"content": ""
},
"freeform_3_content": {
"id": "6510",
"type": "ezxmltext",
"identifier": "freeform_3_content",
"content": "\n\n"
},
"promo_badge": {
"id": "277833",
"type": "ezimage",
"identifier": "promo_badge",
"content": {
"reference": false,
"small": null,
"tiny": false,
"medium": false,
"large": false,
"rss": false,
"width100": false,
"width150": false,
"width200": false,
"width300": false,
"width400": false,
"product_main": false,
"product_main_large": false,
"product_listing": false,
"product_category_listing": false,
"product_media_listing": false,
"rc_full": false,
"main_banner": false,
"main_banner_front": false,
"promo_badge": false,
"multiuploadthumbnail": false,
"original": {
"url": "|"
}
}
},
"weight": {
"id": "433850",
"type": "ezstring",
"identifier": "weight",
"content": "1052"
},
"length": {
"id": "433851",
"type": "ezstring",
"identifier": "length",
"content": "970"
},
"product_attributes": {
"id": "691877",
"type": "blamatrix",
"identifier": "product_attributes",
"content": {
"HTTPValue": null,
"Content": null,
"DisplayInfo": null,
"IsValid": null,
"ContentClassAttributeID": "891",
"ValidationError": null,
"ValidationLog": null,
"ContentClassAttributeIdentifier": "product_attributes",
"ContentClassAttributeCanTranslate": null,
"ContentClassAttributeName": null,
"ContentClassAttributeIsInformationCollector": null,
"ContentClassAttributeIsRequired": null,
"PersistentDataDirty": false,
"InputParameters": false,
"HasValidationError": false,
"DataTypeCustom": null,
"ID": "691877",
"ContentObjectID": "599",
"Version": "26",
"LanguageCode": "eng-EU",
"LanguageID": "8",
"AttributeOriginalID": "0",
"SortKeyInt": "0",
"SortKeyString": "",
"DataTypeString": "blamatrix",
"DataText": "\n<\/name>Title<\/column>Content<\/column><\/columns>Description<\/c><ul><li>I NEED THIS DESC TEXT<\/li><\/ul><\/c>SOME TITLE<\/c><ul><li>THIS TEXT<\/li><\/ul><\/c>THIS TITLE<\/c>THIS TEXT<\/c>THIS TITLE<\/c>AGAIN THIS TEXT<\/c>THIS TITLE<\/c><ul><li>THIS TEXAT<\/li><\/ul><\/c>THIS TITLE<\/c><ul><li>THIS TEXT<\/li><\/ul><\/c>YEP THIS TITLE<\/c>THIS<\/c><\/blamatrix>\n",
"DataInt": null,
"DataFloat": "0"
}
}
}
}];
above is the variable I made as data since we know you have no problem getting the data and bellow is how you access what you need and put it in to a td of tr of table
$('#td_id').append(data[0].data_map.product_attributes.content.DataText);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.