Start a new topic
Answered

Beginner - json response format

Hello all


I have done a search but my question remains unanswered. I am just playing around trying to create a personal app. I have built a script that returns the below response (copy&pasted from view/source). I have tried adding "index":0/1/2 etc but whenever I put my URL in the website creator "URL to get from" (it's a poll app, and the URL in a browser returns the below) I simply get a "wrong data format" message. Note I have tried adding 3 "dummy" frames in the editor and it still doesn't work. Any ideas greatly appreciated! DUe to my age, json return is written via classic asp and output is exactly as below.


{
"frames":[
{
"text":"Ranking the god rays in Nvidia's Fallout 4 mod by subtlety (PC Gamer)",
"icon":"i3301"
}
{
"text":"Fallout 4 1.7.15 Update live on Steam. Xbox One and PS4 coming next week. (Community Announcements)",
"icon":"i3301"
}
{
"text":"Fallout 4 gets Vault 1080 mod from Nvidia (PC Gamer)",
"icon":"i3301"
}
]
}

Best Answer

As per this question, I've had JSON issues as well.


I put your code above into JSONLint for validation.


It looks like you need to split the frames with a comma as per:

{
	"frames": [{
		"text": "Ranking the god rays in Nvidia's Fallout 4 mod by subtlety (PC Gamer)",
		"icon": "i3301"
	}, {
		"text": "Fallout 4 1.7.15 Update live on Steam. Xbox One and PS4 coming next week. (Community Announcements)",
		"icon": "i3301"
	}, {
		"text": "Fallout 4 gets Vault 1080 mod from Nvidia (PC Gamer)",
		"icon": "i3301"
	}]
}

I haven't tested it on the hardware, but it might be somewhere for you to start.


Answer

As per this question, I've had JSON issues as well.


I put your code above into JSONLint for validation.


It looks like you need to split the frames with a comma as per:

{
	"frames": [{
		"text": "Ranking the god rays in Nvidia's Fallout 4 mod by subtlety (PC Gamer)",
		"icon": "i3301"
	}, {
		"text": "Fallout 4 1.7.15 Update live on Steam. Xbox One and PS4 coming next week. (Community Announcements)",
		"icon": "i3301"
	}, {
		"text": "Fallout 4 gets Vault 1080 mod from Nvidia (PC Gamer)",
		"icon": "i3301"
	}]
}

I haven't tested it on the hardware, but it might be somewhere for you to start.

Brilliant thankyou - works a treat!

 

Login or Signup to post a comment