[GIS] GeoServer WMS GetCapabilities AJAX response as JSON

formatgeoservergetcapabilitieswms

How can I get GeoServer WMS GetCapabilities request as JSON?

For example this is a WMS link: https://www.ngs.noaa.gov/GeoServer/NSDE/ows?service=WMS&request=GetCapabilities&

I am getting this request via AJAX call. But response is XML formatted like this:

<Format>text/xml</Format>

<GetCapabilities>
<Format>text/xml</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xlink:type="simple" xlink:href="http://www.ngs.noaa.gov:80/GeoServer/NSDE/ows?SERVICE=WMS&"/>
</Get>
<Post>
<OnlineResource xlink:type="simple" xlink:href="http://www.ngs.noaa.gov:80/GeoServer/NSDE/ows?SERVICE=WMS&"/>
</Post>
</HTTP>
</DCPType>
</GetCapabilities>

I want to get this response as JSON format. Can I change format settings from GeoServer?

Best Answer

It's not possible to get the WMS GetCapabilities response as JSON, only XML is supported, this is what this GeoServer GetCapabilities response is telling you and this is what you are stuck with.

If I remember correctly this is actually specified in the WMS specification, other WMS operations allow a format to be specified, but not the GetCapabilities request.