Jump to content

Topic on API talk:Nearby places viewer

json response format problem

2
Nathanb94 (talkcontribs)

Hi,

I have a problem withe the answer of this model of request(

https://en.wikipedia.org/w/api.php?action=query&format=json&prop=coordinates%7Cpageimages%7Cpageterms&colimit=50&piprop=thumbnail&pithumbsize=144&pilimit=50&wbptterms=description&generator=geosearch&ggscoord=37.786952%7C-122.399523&ggsradius=10000&ggslimit=2)

it's return the POIs around a specific location but the json format is not correct:

the Key "pages" is an object but contains list of POIs.

I think that it's must be change to be an array.

nathan

Harry Wood (talkcontribs)

"pages" is an dictionary (also known as a map, hashmap or associative array) in which the keys are arbitrary strings (page ids).

This is a slightly unusual json API design which some people like to avoid (use just an array instead as you suggest) because it can cause headaches for some API tools/description languages, but it's not invalid.

Reply to "json response format problem"