How can I delete the last character of keys in JSON?

Home / Uncategorized / How can I delete the last character of keys in JSON?

Question:
I need to clean up the JSON code below, by removing the last or last two characters in the KEY i.e. SCHREsubjects0 should be SCHREsubject. I expect large data sets or groups returned

("SCHREsubject0":"41C44DB","SCHREcontaccessment10":"87","SCHREcontaccessment20":"82","SCHREcontaccessment30":"87","SCHREcaproject0":"81","SCHREcatha0":"89","SCHREcanm0":"82","SCHREexamscores0":"87") to ("SCHREsubject20":"41C44DB","SCHREcontaccessment120":"87","SCHREcontaccessment220":"82","SCHREcontaccessment320":"87","SCHREcaproject20":"81","SCHREcatha20":"89","SCHREcanm20":"82","SCHREexamscores20":"87")

Kindly assist
{"SCHREsubject0":"41C44DB","SCHREcontaccessment10":"87","SCHREcontaccessment20":"82","SCHREcontaccessment30":"87","SCHREcaproject0":"81","SCHREcatha0":"89","SCHREcanm0":"82","SCHREexamscores0":"87","SCHREsubject1":"2AC20C5","SCHREcontaccessment11":"82","SCHREcontaccessment21":"87","SCHREcontaccessment31":"82","SCHREcaproject1":"89","SCHREcatha1":"81","SCHREcanm1":"87","SCHREexamscores1":"82","SCHREsubject2":"FFF7215","SCHREcontaccessment12":"87","SCHREcontaccessment22":"81","SCHREcontaccessment32":"89","SCHREcaproject2":"82","SCHREcatha2":"87","SCHREcanm2":"82","SCHREexamscores2":"89","SCHREsubject3":"DFC1266","SCHREcontaccessment13":"82","SCHREcontaccessment23":"87","SCHREcontaccessment33":"82","SCHREcaproject3":"89","SCHREcatha3":"82","SCHREcanm3":"87","SCHREexamscores3":"82","SCHREsubject4":"12DE4EA","SCHREcontaccessment14":"81","SCHREcontaccessment24":"87","SCHREcontaccessment34":"82","SCHREcaproject4":"89","SCHREcatha4":"82","SCHREcanm4":"87","SCHREexamscores4":"81"}


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *