I am able to post User credentials to word press API end point and validate the login credentials and it gives me back a JSON as show below , how should I parse this JSON object in the data to get the value of ID from the following JSON Response
{
"data": {
"ID": "1",
"user_login": "[email protected]",
"user_pass": "$P$B2yv.gPx6pYXvnO6u59zkGZdUhXddddXRw.",
"user_nicename": "jerry-abrahameeee",
"user_email": "[email protected]",
"user_url": "",
"user_registered": "2019-10-09 07:05:56",
"user_activation_key": "",
"user_status": "0",
"display_name": "[email protected]"
},
"ID": 1,
"caps": {
"administrator": true
},
"cap_key": "wp_capabilities",
"roles": ["administrator"],
"allcaps": {
"switch_themes": true,
"edit_themes": true,
"edit_others_user_registrations": true,
"publish_user_registrations": true,
"read_private_user_registrations": true,
"delete_user_registrations": true,
"delete_private_user_registrations": true,
"delete_published_user_registrations": true,
"delete_others_user_registrations": true,
"edit_private_user_registrations": true,
"edit_published_user_registrations": true,
"manage_user_registration_terms": true,
"edit_user_registration_terms": true,
"delete_user_registration_terms": true,
"assign_user_registration_terms": true,
"manage_email_logs": true,
"administrator": true
},
"filter": null
}
You first need to make classes the same as their entities, then you need to use
JsonUtilityconvert a json string to the classes you created. I made an example here using a json file in the resources folder to make it clear how you need to read this data, something like this: