Reading a generated JSON File in Java -


i'm asking because searching while , had no luck.

•• first of all, put here link page links of project needed see i'm doing. put them here because otherwise can't. can put 2 links. link: http://pastebin.com/rry5cbcd ••

i'm coding in java to-do list. want make save/load system using json. finished save class, it's in link above.

now i'm doing load class. want class loading data file it's generated info in jlist , saving data object array, arraylist or making visible in jlist. if info in variable know how make visible in jlist. problem don't know how read data jsonobject in jsonarray generated user (because data in json file user puts in jlist don't know how many elements user add). in link above.

if need else, main class or something, project in link above.

i didn't find nothing in google reading generated json file. need guys.

and, last 1 thing, sorry english.

you can use jackson task easy.

add following dependencies

    <dependency>         <groupid>org.codehaus.jackson</groupid>         <artifactid>jackson-core-asl</artifactid>         <version>1.9.9</version>     </dependency>     <dependency>         <groupid>org.codehaus.jackson</groupid>         <artifactid>jackson-mapper-asl</artifactid>         <version>1.9.9</version>     </dependency> 

create pojo class corresponding json fields


in class loading json data add following:-

import org.codehaus.jackson.jsonparser;

import org.codehaus.jackson.map.objectmapper;

and

objectmapper mapper = new objectmapper(); mapper.configure(jsonparser.feature.allow_comments, true); mapper.configure(org.codehaus.jackson.map.deserializationconfig.feature.fail_on_unknown_properties, true);

pojoclass[] jsonrecords = mapper.readvalue(jsonfile, pojoclass);


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -