How to read jsonp response

387 views Asked by At

I have a json file (http://example.com/usr/details?jsonp=parseRespond ) on a another server that gives the response

{
  "id": "5572a7d648b33a462d79145d",
  "avatarHash": null,
  "bio": "",
  "bioData": null,
  "confirmed": false,
  "fullName": "Ender Widgin",
  "idPremOrgsAdmin": null,
  "initials": "EW",
  "memberType": "normal",
  "products": [],
  "status": "disconnected",
  "url": "https://example.com/enderwidgin",
  "username": "enderwidgin",
  "avatarSource": null,
  "email": null,
  "gravatarHash": null,
  "idBoards": [],
  "idOrganizations": [],
  "loginTypes": null,
  "oneTimeMessagesDismissed": null,
  "prefs": null,
  "trophies": [],
  "uploadedAvatarHash": null,
  "premiumFeatures": [],
  "idBoardsPinned": null,
  "organizations": [],
  "boards": [],
  "actions": []
}

How can I write this response in a div

function parseRespond(){ 
 // how to get the data ? 
} 

Thanks in advance!

1

There are 1 answers

1
Debasish Mohapatra On

JSON.parse may be helpful,

function parseRespond(response){ 
    response = JSON.parse(response);
}