convert json string to json object in laravel
$manage = json_decode($request->stdin, true);
print_r($manage);
convert json string to json object in laravel
$manage = json_decode($request->stdin, true);
print_r($manage);
how to convert jsonobject
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
public class TestJSON {
public static void main(String[] args) {
JSONObject jObject = new JSONObject();
jObject.put("EmployeeId", new Integer(121));
jObject.put("Name", "Ramesh");
jObject.put("Salary", new Double(15000.00));
jObject.put("isPermanent", new Boolean(true));
jObject.put("Nickname", null);
//convert from JSONObject to JSON string
String jsonText = jObject.toJSONString();
System.out.println(jsonText);
JSONParser parser = new JSONParser();
//convert from JSON string to JSONObject
JSONObject newJObject = null;
try {
newJObject = (JSONObject) parser.parse(jsonText);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(newJObject.get("EmployeeId"));
System.out.println(newJObject.get("Name"));
System.out.println(newJObject.get("Salary"));
System.out.println(newJObject.get("isPermanent"));
System.out.println(newJObject.get("Nickname"));
}
}
convert json string to json object in java
try {
JSONObject jsonObject = new JSONObject("{\"phonetype\":\"N95\",\"cat\":\"WP\"}");
}catch (JSONException err){
Log.d("Error", err.toString());
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us