GeneCode
GeneCode

Reputation: 7588

Standard Json Reply from an API Call

I am having argument with a friend here we are working on a project together. I am handling the front end and he is doing the backend API. I told him to return pure Json text in his reply to the API call. But instead, he replied with something like below:

callBackFunction({"sample": "value"});

I told him, it is supposed to be only

{"sample": "value"}

But he insisted that his way is the STANDARD JSON REPLY. We are still arguing about this till today.

For now, I manually trim the extra texts just to get the Json, it works OK, but trimming texts and characters is so dangerous, prone to error etc. So, I want to ask all programmers in the world, is the callBackFunction() is part of the standard JSON reply???? It doesn't make sense to me.

Upvotes: 0

Views: 196

Answers (1)

ShadowGunn
ShadowGunn

Reputation: 370

This has been answered here Is there any standard for JSON API response format?. But yes {"sample": "value"} would be considered the standard way to receive JSON

Upvotes: 1

Related Questions