Cancelled

Retrieving a third level nested JSON subobject in SFMC (Exact Target)

We are trying to retrieve a piece of content from a JSON call but we are unable to successfully retrieve it from a third level nested subjobject.

The following code successfully retrieves from the second subobject but we cannot figure out how to get the third.

%%[ var @Json2 set @Json2 = HTTPGet("https://mywebsite/productid",false,0,@CallStatus) ]%%

{{.datasource JSONVar type=variable maxRows = 20}}

{{.data}}

{ "target" : "@Json2" }

{{/data}}

Name: {{name}}

productcode: {{baseProductCode}} {{/datasource}}

<script runat=server> function set(key, val) { var newVal = val != null ? Stringify(val) : "{}"; [url removed, login to view](key, newVal); }

[url removed, login to view]("Core","1");

var Json=[url removed, login to view]("@Json2");

var _JsonObject = eval('(' + Json + ')');

set("@colourVariants", [url removed, login to view]); </script>

{{.dataobject ColorVar type=variable source=@colourVariants maxrows=20}}

{{.data}}

{"target": "@colourVariants"}

{{/data}} {{/dataobject}} Here is the price: {{#ColorVar}} {{Price}} {{/ColorVar}} {{/datasource}}

We are trying to pull out the standard tag which is in the media object, which is a subobject of colorvariants. JSON code is below:

{"baseProductCode":"P52789915","displayColour":"#00AB84","name":"Men's Slip On Safety Shoe Burke - Black","description":"Men's slip on work shoe featuring a steel toe, a leather upper for durability and a technical cushioned insock to absorb shock when walking.","ratings":2.3333333333333335,"colourVariants":[{"code":"52789915","name":"Men's Slip On Safety Shoe Burke - Black","sizeVariants":[{"code":"52790010","name":"6","price":"$69","inStock":true},{"code":"52790027","name":"7","price":"$69","inStock":true},{"code":"52790034","name":"8","price":"$69","inStock":false},{"code":"52790041","name":"9","price":"$69","inStock":true},{"code":"52790058","name":"10","price":"$69","inStock":true},{"code":"52790065","name":"11","price":"$69","inStock":true},{"code":"52790072","name":"12","price":"$69","inStock":true}],"media":[{"standard":"[url removed, login to view]","thumbnail":"[url removed, login to view]"},{"standard":"[url removed, login to view]","thumbnail":"[url removed, login to view]"}],"price":"$69","inStock":true}],"features":[{"name":"Materials and Composition","value":["Upper: Leather","Lining: Synthetic","Sole: Synthetic"]},{"name":"Product Features","value":["Leather upper","Steel toe","Technical cushioned insock to absorb shock when walking"]},{"name":"Care Instructions","value":["Machine Washable"]}],"sizeChartUrl":"[url removed, login to view]","deliveryModes":[{"available":true,"description":"Free for orders over $19. Not available to all stores. Allow 4-10 business days before pickup.","name":"Click + Collect","excludesCountryStore":false},{"available":true,"description":"Free for orders over $75 (excluding large items). Allow 3-10 business days for delivery.","name":"Home Delivery","excludesCountryStore":false},{"available":false,"description":"For apparel only orders. Not available to all locations. Available for orders placed by 12pm Mon to Fri","name":"Express Delivery","excludesCountryStore":false}],"infoLinks":[{"name":"FAQs","url":"[url removed, login to view]"},{"name":"Payments + Delivery","url":"[url removed, login to view]"},{"name":"Refunds + Returns","url":"[url removed, login to view]"}],"code":"52790027"}

Please only respond if you know who to do this in Sales Force Marketing Cloud (Exact Target).

Cheers

Skills: Email Marketing, Salesforce.com

See more: www target com, www salesforce, www force com, work from home ratings, salesforce content delivery, piece work from home, orders salesforce, men work from home, marketing function in a business, level s, how to work from home successfully, how to null a script, how to get to a size 0, home delivery business, content delivery salesforce, cloud 10 work from home, click safety, care core, care cloud, exact target rails example

About the Employer:
( 24 reviews ) Sydney, Australia

Project ID: #8788771