nix_stack nix_stack - 1 month ago 7
JSON Question

Error while parsing JSON from analytics

I need help with below.

I have json data from Google analytics in below form :

...............(upto 100k records)

and java code I have is :

JsonParser parser = new JsonParser();
JsonElement root = parser.parse(jsonData);

based on GSON libraries. I am getting "MalformedJsonException" while running this. Expected EOF at line 1 column 53


I tried below and it works.

        BufferedReader br = new BufferedReader(fileReader);
        String line = br.readLine();
        JsonParser parser = new JsonParser();
        JsonObject root = (JsonObject)parser.parse(line);;