Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Not understand json from petfinder.com, doesn't seem to match the same response in xml  RSS feed

 
William Barnes
Ranch Hand
Posts: 1049
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calling the random pet operation, this is RESTful.  And is only returning a random pet id number.  xml is the default response, but you can also request json.  In the json response what is "$t"? 

The xml response


The json response (line breaks added)

fyi - https://www.petfinder.com/developers/api-docs

 
William Barnes
Ranch Hand
Posts: 1049
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess my only question is - what is "$t".  I think I understand the rest of it.  Thanks.
 
Ron McLeod
Saloon Keeper
Posts: 1561
222
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Their JSON implementation doesn't seem to be fully baked - what is the XML namespace and schema doing in the JSON response? 

I would have expected something more like this:

I didn't see any real mention of JSON other than "The JSON output is based on the standard used by the Google Data API. You can change the output to JSON with format=json. For now we'll focus on the XML format here, but the concepts are directly applicable to JSON."

If you can, it would probably be better to use XML rather than JSON - it seems to be fairly well documented.
 
William Barnes
Ranch Hand
Posts: 1049
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must be right.  The "$t" looks like a goofy place holder, when there is no "name" and just a "value".  Thanks.
 
Rob Spoor
Sheriff
Posts: 21048
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like a horrible automatic conversion from the XML schema. petIds is probably the worst example - instead of what should probably be a list, it's now an object. That means that you can't add multiple ids to it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!