java - convert JSON data to mysql database -
the response rest server json format. need put result mysql database via java coding. don't know how deal this.
basically, use jdbc connect mysql add, delete, , updata, time first thing retrieve restful server, store results database. , result json format, instance: json response
{ "columns": "score", "reportlist": [ { "rowcount": 8063, "rowlist": [ "2013-07-09,20:00:00,73.2,", "2013-07-09,20:05:00,73.3,", "2013-07-09,20:10:00,73.4,", "2013-07-09,20:15:00,73.4,", "2013-07-09,20:20:00,73.5,", ... ... ] } ], "startdate": "2013-07-10", "enddate": "2013-08-06", "status": { "code": 0, "message": "" } }
from result, columns:"timestamp" , "score" table column, , rowlist: 2013-07-09 , 73.2 value of column. these variable , value need. how map json valuable data, put database finally.
based on json.org website (http://json.org/java/) looks can parse response java object or array , pull values there pass jdbc.
jsonarray jsonarray = jsonarray.readfrom( string )
http://eclipsesource.com/blogs/2013/04/18/minimal-json-parser-for-java http://json.org/javadoc/org/json/jsonarray.html http://json.org/javadoc/org/json/jsonobject.html
Comments
Post a Comment