java - Expected BEGIN_ARRAY but was STRING -


I am trying to parse JSON Array using this code.

  Public square key {static class item} {@ sriajatnam ("id") public string id; @ SerializedName ("name") The name of the public string; @ SerializedName ("Time-timestart") public string timingTit; @ SerializedName ("timeline") public string timeliness; @ Serialized Names ("Estime") Public String Estimate; @ SerializedName ("location") public string location; @ SerializedName ("description") public string description; } Private static string reader throws exception (string url string) {BufferedReader reader = null; {URL url = Try new URL (urlString); Reader = new buffed reader (new input screen reader (url.openstream ())); String buffer buffer = new stringbuffer (); Read int; Four [] characters = new colors [1024]; While ((read = reader.read (chars))! = -1) Buffer.Append (character, 0, reading); Return buffer. To string (); } Finally {if (reader! = Null) reader.Coll (); }} Public static zero major (string [] args throws exceptions {GSON GSN = new GSON (); String fromURL = readUrl ("http://ec2-54-69-156-10.us-west-2.compute.amazonaws.com/getactivities.php"); String \ "time \ \ "Location \": \ "location \": \ "\", \ "description \": \ "my Ćμpi! \"}, {\ "Id \" ": \" name \ ": \" My Ramatokoku \ ", \" TimeTime \ ": \" \ ", \" TimeTime \ ": \" \ ", \" esttime \ ": \" "00:00:00 \", \ " Location \ ": \" \ "my \ Ćμpi! \"}] "; [Item] [data] = GS.N. From Jason (non-worl, item []. Square);}} < / Code> 

It works fine with nonURL input and parse, but withURL in the input "expected BEGIN_ ARRAY but STRING was ".

I'm thinking FromURL is in front of it" And this is the reason that there are problems, but I'm out of ways to fix it.

In the reply received from the URL & lt; Meta charset = "UTF-8" & gt;

P>

  string fromURL = readUrl ("http: // ec2-54- 69-156-10.us-west-2.compute.amazonaws.com/getactivities.php"); FromURL = fromURL.replace ("meta charset = \" UTF-8 \ "& gt;", "" "); item [] data = gson.fromJson (from the URL, item []. Square); < / Code> 

Edit: Current response:

   [ "Id": "1", "name": "my ramatococu", "time-termitent": "", "timeline": "", "time is": "00:00:00", "location": "", "Details": "My IPP! "}", "Id": "2", "name": "my juskma", "timeline", "time": "", "estuary": "00:00:00", "location": "Time", "Time", "Time": "", "Estime", "", "description": "game on ice"}, {"id": "3", "name": "teinak", "time-timent" : "00:00:00", "location": "", "description": "1 tund"}]  

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -