• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Formatting JSON

New Here ,
Oct 20, 2008 Oct 20, 2008

Copy link to clipboard

Copied

I am really frustrated right now. I have a method with the return format as JSON. All fine and good, but the ouptut looks like this:

[{"KEY":"Grindhouse Trash 03 How to Make a Dirty Movie","STYLELIST1":"|\\| |_| |_ |_","STYLELIST2":"|\\| |_| |_ |_","DISPLAYTYPEID":0,"PRODUCTSEQUENCE":"|\\| |_| |_ |_","DISPLAYPRODUCTSKUS":[{"STOCKSTATUSID":1,"STARTSHIPDATE":"10\/11.....and so on.

I somehow need to change that into some variables, the product name and the product id that i will return to the page. I have no idea how to do this. Can someone help me please? Below is my CFC code and my return code on the page.

CFC Code......

<cffunction name="search" access="remote" returnformat="json" output="false" hint="affiliates enter in a string, we bring them back the product info">
<cfargument name="searchString" required="yes"/>
<cfscript>
var resultFilter=null;
var query=null;
var result=null;


resultFilter = CreateObject("component", "COM.tlavideo.results.Filter");
resultFilter.addFilter(prop="specialexclude",val="false");

query=component("COM.tlavideo.results.Query").init(narrowingFilter=resultfilter, searchstring=arguments.searchstring, searchgroup="product");
result=query.getResult(resultgroup="product", pagingneeded="false", pageNum="1", pageSize="50");

return serializeJSON(result.get("productresults"));

</cfscript>
</cffunction>
</cfcomponent>


CODE ON PAGE.....

<cfif structkeyexists(form, "search")>
<cfset affiliatessearch=createobject("component", "affiliates.affiliatestextsearch")>
<cfset result=affiliatessearch.search(form.search)>
<cfoutput>#result#</cfoutput>
</cfif>
TOPICS
Advanced techniques

Views

272

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 27, 2009 Feb 27, 2009

Copy link to clipboard

Copied

LATEST
The stuff it returns is a Javascript object. You should be able to type something like the following to get it into the browser's memory. Then you have to figure out how to loop over it using Javascript and get the data you want out.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation