Copy link to clipboard
Copied
I'm sure this is a simple thing to do, sadly I'm stuck! Any help would be appreciated.
I need to create a query from a json file from Groupon. I can get the file, deserialize it but then I just run into a brick wall!
<!--- Make the request to the API --->
<!--- Get the JSON Feed --->
<cfhttp url="https://partner-int-api.groupon.com/deals.json?country_code=IE&tsToken=IE_AFF_0_200012_212556_0&divi...">
<!--- Strip the function wrapper. --->
<cfset theData=REReplace(cfhttp.FileContent,
"^\s*[[:word:]]*\s*\(\s*","")>
<cfset theData=REReplace(theData, "\s*\)\s*$", "")>
<!--- Test JSON data. --->
<cfif !IsJSON(theData)>
<h3>The URL you requested does not provide valid JSON</h3>
<cfelse>
<cfdump var="#theData#">
</cfif>
The file is at: http://www.thefuture.tv/grouponJSON.cfm
Copy link to clipboard
Copied
I'm not sure what you're trying to do with the REreplace(), but you have an odd number of parenthesis (two left, one right) in that tag. That might be part of the problem.
HTH,
^_^
Copy link to clipboard
Copied
WolfShade I think the extra parantheses in both REReplace statements are escaped by the preceding backslash, so they may be intended.
leDuke - I'm wondering why the need to do any REReplace stuff - when I look at the original URL in Chrome, it appears to be coming back as clean JSON. What are you trying to solve?
Copy link to clipboard
Copied
Not sure what you are doing with the REReplace. If could explain the reason for this that may help.
If I run this I get a proper struct duped out.
<cfdump var="#deserializeJSON(cfhttp.FileContent)#">
Copy link to clipboard
Copied
leDuke wrote:
I need to create a query from a json file from Groupon. I can get the file, deserialize it but then I just run into a brick wall!
Until you tell us what the brick wall is, I shall assume it's the one between your kitchen and your living room.