nix_stack nix_stack - 1 year ago 111
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

Answer Source

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);;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download