Json parse using GSON : JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $

<>

This question already has an answer here:

Answers


Remove square bracket from first and last and try .

So your string will be like below .

{"place_id":"14004695","licence":"Data © OpenStreetMap contributors, ODbL 1.0. http:\/\/www.openstreetmap.org\/copyright","osm_type":"node","osm_id":"1292272363","boundingbox":["48.8634698","48.8635698","2.3724866","2.3725866"],"lat":"48.8635198","lon":"2.3725366","display_name":"42, Rue de la Folie-Méricourt, St-Ambroise, 11th Arrondissement, Paris, Ile-de-France, Metropolitan France, 75011, France","class":"place","type":"house","importance":0.611}

Try this:

GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = gsonBuilder.create();
Type listType = new TypeToken<List<OSRMAddress>>() {}.getType();           
List<OSRMAddress> list = gson.fromJson(new InputStreamReader(inputStream), listType);

Need Your Help

reading Excel Open XML is ignoring blank cells

excel datatable openxml openxml-sdk

I am using the accepted solution here to convert an excel sheet into a datatable. This works fine if I have "perfect" data but if I have a blank cell in the middle of my data it seems to put the w...