I'd appreciate any help I could get with this — I've been scouring stack overflow and couldn't find anything that directly related with what I'm trying to accomplish.
Issue: I'm trying to update a specific name/value pair in a JSON file, and I'm trying to do it by sending specific parameters through an AJAX call to a PHP file. Two of the parameters are the path (delineated with hyphens) to the name, and the value that I'm swapping in.
A small portion of the JSON:
{
"character" :
{
"name" : "Foo",
"species" : "Bar",
}
}
Using this JSON as an example, I'm trying to update a specific array value, such as:
$char['character']['name']
I'm passing a variable to the PHP file with the path information, such as:
updater.php?char=character-name&val=Newname
Is there a way to convert the string "character-name" (or any string for that matter with a particular delineation) to the path in an Array, like $char['character']['name']
?