Home > Back-end >  Extract the json array
Extract the json array

Time:09-30

Var STR=[{" name ":" CXH ", "sex" : "man"}, {" name ":" cxh1 ", "sex" : "man1"});

//how to put in the array "H", "4", "points" to extract the log out,

The log (STR)

CodePudding user response:

The
refer to the original poster qq_45860132 response:
var STR=[{" name ":" CXH ", "sex" : "man"}, {" name ":" cxh1 ", "sex", "man1"}].

//how to put in the array "H", "4", "points" to extract the log out,

The log (STR)

The above expression is wrong, will be subject to this,
Var STR=[{" words ", "H"}, {" words ":" 4 "}, {" words ":" points "});

//how to put in the array "H", "4", "points" to extract the log out,

The log (STR)

CodePudding user response:

Didn't know what you mean, do you want to remove the value value, then the value is an empty string array object inside, but you extracted the value of the array is another? Cycle through out the key, then the value blank

CodePudding user response:

The var is what, you write it in JS, make this into a JsonArray fastjson in Java, then traverse the output

CodePudding user response:

Didn't see what's the result of the LZ want, is to extract the "H", "4", "points" print log? STR or remove "H", "4", "points", keep [{" words ":" "}, {" words ":" "}, {" words ":" "}] print log?
Give you a sample, according to the demand change
 
Var STR=[{" words ", "H"}, {" words ":" 4 "}, {" words ":" points "});
Var arr=[];
STR. ForEach (e=& gt; {
Object. Entries (e). ForEach (((k, v))=& gt; {
Arr. Push (v);
})
})
console.log(arr);//to extract the "H", "4" and "points" print log
  • Related