Here's my problem: I've got a JSON-formatted response and want to match some variables over the response. I'm doing it using Cases
:
JsonResponse := Import["https://reverse.geocoder.api.here.com/6.2/reversegeocode.json?&app_code=djPZyynKsbTjIUDOBcHZ2g&app_id=xWVIueSv6JL0aJ5xqTxb&gen=3&int=true&jsonAttributes=1&languages=it-it&maxresults=9&mode=retrieveAddresses&prox=43.605979206920594,13.513478915691394,100", "JSON"]
Points = Cases[JsonResponse, {___ "displayPosition" -> "{latitude" -> lat_,"longitude" -> long_ "}", "navigationPosition" -> "{{latitude" -> _Float, "longitude" -> _Float "}}", "mapView" -> "{bottomRight" -> "{latitude" -> _Float, "longitude" -> _Float "}", "topLeft" -> "{latitude" -> _Float, "longitude" -> _Float "}}", "locationId" -> _String, "locationType" -> "point", "address" -> "{city" -> _String, "label" -> _String, "country" -> _String, "county" -> county_, "state" -> state_, "street" -> st_, "houseNumber" -> num_, postalCode -> zip_ ___} -> {{lat, long} -> {st, num, zip, county, state}}, Infinity]
I need to make it consider the inner braces as part of the pattern to be matched (Mathematica parses them as meaning list, otherwise).
Cases[JsonResponse, "distance" -> dist_ :> dist, Infinity]
$\endgroup$