Home > database >  How to become to a json string split the following format a great god, please give directions
How to become to a json string split the following format a great god, please give directions

Time:12-17

{" 0000-01-01 00:00:00 ": 282.700000000000000000," the 2020-11-13 17:17:46. 0 ": 381.300000000000000000}
How json string at the top of the mysql will split into as shown in the figure below style

The great god give directions, thank you very much

CodePudding user response:

The front desk and then parse the json format to the background using SQL to the database

CodePudding user response:

Analytic:
 
Public static void main (String [] args) {
{String SRC="https://bbs.csdn.net/topics//" 0000-01-01 00:00:00 \ ": 282.700000000000000000, " the 2020-11-13 17:17:46. 0 \ ": 381.300000000000000000}";
JSONObject Jo=JSON. ParseObject (SRC);
If (Jo==null) {
System. The out. Println (" invalid json string ");
return;
}

Set Keys=Jo. KeySet ();
For (String key: keys) {
Object v=Jo. Get (key);
System. Out.println (" key: "+ key +", value: "+ (n==null? Null: v.t oString ()));
}
}

Output:
Key: the 2020-11-13 17:17:46. 0, the value: 381.300000000000000000
Key: the 0000-01-01 00:00:00, value: 282.700000000000000000

Other: you encapsulate a function, the data parsed, the deposit to the data, here is not tired above,
  • Related