title: Parsing JSON gives error org.json.JSONException: Expected literal value
body: <p>Hi i have a JSON file saved in a txt file and i am parsing it in my android code. I keep getting a JSONSyntax lateral exception. I used a json validator and my json syntax is correct. I really don't know the problem. Can someone pls help me out.
  I used this JSON object array in my file</p>
  
  <pre><code>    {"destinations": [
          {
              "name": "Aegean Coast",
              "id": "001"
          },
          {
              "name": "Black Sea",
              "id": "002"
          },
          {
              "name": "Central and eastern Anatolia",
              "id": "003"
          },
          {
              "name": "Istanbul",
              "id": "004"
          },
          {
              "name": "Lycian Way",
              "id": "005"
          },
          {
              "name": "Georgia",
              "id": "006"
          }
      ]
  }
  </code></pre>
  
  <p>This is my android class fragment where i access my json objects:</p>
  
  <pre><code>        public class DestinationsFragment extends Fragment {
      private GoogleMap map;
  
  
  
       public View onCreateView(LayoutInflater inflater, ViewGroup container,
                  Bundle savedInstanceState) {
  
  
              View rootView = inflater.inflate(R.layout.fragment_destinations, container, false);
              ListView listview= (ListView)rootView.findViewById(R.id.list);
              String feed = loadJSONFromAsset();
  
              try {
                   ArrayList&lt;String&gt; items = new ArrayList&lt;String&gt;();
                JSONArray jsonArray = new JSONArray(feed);
                for (int i = 0; i &lt; jsonArray.length(); i++) {
                  JSONObject jsonObject = jsonArray.getJSONObject(i);
               String name= jsonObject.getString("name");
               items.add(name);
               Log.d(name,"Output");
                }
                ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(getActivity(),R.layout.list_item, items);
                listview.setAdapter(adapter);
  
              } catch (Exception e) {
                e.printStackTrace();
              }
  
  
              return rootView;
          }
  
  
  
       public String loadJSONFromAsset() {
              String json = null;
              try {
  
                  InputStream is = getActivity().getAssets().open("destinations.txt");
                  int size = is.available();
                  byte[] buffer = new byte[size];
                  is.read(buffer);
                  is.close();
                  json = new String(buffer, "UTF-8");
  
              } catch (IOException ex) {
                  ex.printStackTrace();
                  return null;
              }
              return json;
  
  }
  }
  </code></pre>
  
  <p>This is my logcat error ouput:</p>
  
  <pre><code> 06-02 11:51:47.027: W/System.err(6304): org.json.JSONException: Expected literal value at character 1 of {\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf200
  06-02 11:51:47.027: W/System.err(6304): {\fonttbl\f0\fmodern\fcharset0 CourierNewPSMT;}
  06-02 11:51:47.027: W/System.err(6304): {\colortbl;\red255\green255\blue255;}
  06-02 11:51:47.027: W/System.err(6304): \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
  06-02 11:51:47.027: W/System.err(6304): \deftab720
  06-02 11:51:47.027: W/System.err(6304): \pard\pardeftab720
  06-02 11:51:47.027: W/System.err(6304): \f0\fs28 \cf0 \{"destinations": [\
  06-02 11:51:47.027: W/System.err(6304):         \{\
  06-02 11:51:47.027: W/System.err(6304):             "name": "Aegean Coast",\
  06-02 11:51:47.027: W/System.err(6304):             "id": "001"\
  06-02 11:51:47.027: W/System.err(6304):         \},\
  06-02 11:51:47.027: W/System.err(6304):         \{\
  06-02 11:51:47.027: W/System.err(6304):             "name": "Black Sea",\
  06-02 11:51:47.027: W/System.err(6304):             "id": "002"\
  06-02 11:51:47.027: W/System.err(6304):         \},\
  06-02 11:51:47.027: W/System.err(6304):         \{\
  06-02 11:51:47.027: W/System.err(6304):             "name": "Central and eastern Anatolia",\
  06-02 11:51:47.027: W/System.err(6304):             "id": "003"\
  06-02 11:51:47.027: W/System.err(6304):         \},\
  06-02 11:51:47.027: W/System.err(6304):         \{\
  06-02 11:51:47.027: W/System.err(6304):             "name": "Istanbul",\
  06-02 11:51:47.027: W/System.err(6304):             "id": "004"\
  06-02 11:51:47.027: W/System.err(6304):         \},\
  06-02 11:51:47.027: W/System.err(6304):         \{\
  06-02 11:51:47.027: W/System.err(6304):             "name": "Lycian Way",\
  06-02 11:51:47.027: W/System.err(6304):             "id": "005"\
  06-02 11:51:47.027: W/System.err(6304):         \},\
  06-02 11:51:47.027: W/System.err(6304):         \{\
  06-02 11:51:47.027: W/System.err(6304):             "name": "Georgia",\
  06-02 11:51:47.027: W/System.err(6304):             "id": "006"\
  06-02 11:51:47.027: W/System.err(6304):         \}\
  06-02 11:51:47.027: W/System.err(6304):     ]\
  06-02 11:51:47.027: W/System.err(6304): \}}
  06-02 11:51:47.037: W/System.err(6304):     at org.json.JSONTokener.syntaxError(JSONTokener.java:450)
  06-02 11:51:47.037: W/System.err(6304):     at org.json.JSONTokener.readLiteral(JSONTokener.java:285)
  06-02 11:51:47.037: W/System.err(6304):     at org.json.JSONTokener.nextValue(JSONTokener.java:111)
  06-02 11:51:47.037: W/System.err(6304):     at org.json.JSONTokener.readObject(JSONTokener.java:362)
  06-02 11:51:47.037: W/System.err(6304):     at org.json.JSONTokener.nextValue(JSONTokener.java:100)
  06-02 11:51:47.037: W/System.err(6304):     at org.json.JSONArray.&lt;init&gt;(JSONArray.java:87)
  06-02 11:51:47.037: W/System.err(6304):     at org.json.JSONArray.&lt;init&gt;(JSONArray.java:103)
  </code></pre>
  
  <p>'</p>