java - A JSONObject text must begin with '{' -
i have '{' @ beginning, here json file
{ "rooms": [ {"x":1}, {"y":1} ] }
maybe can't read file? here's code:
jsontokener tokener = new jsontokener("res/map.json"); jsonobject test = new jsonobject(tokener);
jsontokener tokener = new jsontokener("res/map.json");
this doesn't read file res/map.json
. tries tokenize string "res/map.json"
json. since string isn't json, doesn't work.
if want read file, try passing in java.io.filereader
:
jsontokener tokener = new jsontokener(new filereader("res/map.json"));
Comments
Post a Comment