I have a string in java
String val = "{"column":[{"name":"id,"type":"int"},{"name":"empname","type":"string"}], "database":"test","table":"sample"}"
How do I retrieve only the column name My result must be a string containing the column names delimited by tabspace i.e
Expected Output
id empname
Your JSON is not valid (it seems that
"
is missing afterid
among other issues), but assuming you'd have a similarly structured valid one, you could use lib org.json as stated in accepted answer of this question: How to parse JSON in Java ?In your case, you need following code: