**First of all: XAPI does not support JSON at all. The follow answer will help you to create an equivalent Overpass XML / QL query which comes with JSON output. Use it as a replacement of your current XAPI query.**
If you prepend your XAPI query with "debug=", you can see the actual Overpass XML representation of the XAPI query. We use this as a starting point to create an equivalent query which returns JSON instead of XML. BTW: Internally, your XAPI query is converted into exactly this format before is it being executed by overpass api.
http://www.overpass-api.de/api/xapi?debug=*[maxspeed=][bbox=-106.631425,52.078132,-106.566537,52.146866]
Result:
<query type="node">
<bbox-query s="52.078132" n="52.146866" w="-106.631425" e="-106.566537"/>
<has-kv k="maxspeed" v=""/>
</query>
<union>
<item/>
<query type="way">
<bbox-query s="52.078132" n="52.146866" w="-106.631425" e="-106.566537"/>
<has-kv k="maxspeed" v=""/>
</query>
<recurse type="way-node"/>
</union>
<print/>
<query type="relation">
<bbox-query s="52.078132" n="52.146866" w="-106.631425" e="-106.566537"/>
<has-kv k="maxspeed" v=""/>
</query>
<print/>
Simply embed this into
Now, we need to tell Overpass API to return the result in JSON format. This can be achieved by adding an osm-script header with a dedicated output attribute:
<osm-script output="json">
...
</osm-script>
and you'll If you run this query, you will get exactly the same date as per your XAPI request query, now with JSON format output. Try this in JSON format: overpass turbo. http://overpass-turbo.eu/s/6nr
Or try If you favor Overpass QL format, which you can get in overpass turbo, easily convert your Overpass XML query by clicking on Export -> Query -> Overpass QL:
QL in overpass turbo. That's how this would look like.
[out:json]
;
node
(52.078132,-106.631425,52.146866,-106.566537)
["maxspeed"];
(
._;
way
(52.078132,-106.631425,52.146866,-106.566537)
["maxspeed"];
node(w);
);
out;
relation
(52.078132,-106.631425,52.146866,-106.566537)
["maxspeed"];
out;