Activity › Forums › Salesforce® Discussions › What is the difference between JSON and JSONP in Salesforce?
Tagged: JSON, JSONP, Salesforce Development, Salesforce JSON
-
What is the difference between JSON and JSONP in Salesforce?
Posted by suniti on July 9, 2018 at 8:28 AMWhat is the difference between JSON and JSONP in Salesforce?
shariq replied 7 years, 8 months ago 4 Members · 3 Replies -
3 Replies
-
Hi Suniti,
JSON: JSON is a simple data format used for communication medium between different systems
JSONP: It is a methodology for using that format with cross-domain ajax requests while not being affected by the same origin policy issue.Thanks.
- [adinserter block='9']
-
JSONP is a simple way to overcome browser restrictions when sending JSON responses from different domains from the client. But the practical implementation of the approach involves subtle differences that are often not explained clearly. Here is a simple tutorial that shows JSON and JSONP side by side.
JSON
{“name”:”stackoverflow”,”id”:5}JSONP
func({“name”:”stackoverflow”,”id”:5});Thanks
-
Hi,
To make it more simple –
JSONP is JSON with padding, that is, you put a string at the beginning and a pair of parenthesis around it. For example:
//JSON
{“helps”:”old”,”age”:55}
//JSONP
onOff({“helps”:”new”,”age”:65});Hope this helps.
Log In to reply.