PDA

View Full Version : Get name variable from an object


Kirko
07-10-2016, 07:16 PM
I'm trying to get the name variable from an object but not the name variable that it thinks I'm trying to get :o

The object has a custom variable called name but when ever I echo it, it will just echo the name of the variable. this sounds confusing.. anyhow

All these echo 'c' but there's actually something assigned to temp.c.name which I'm trying to get but can't figure it out
If it helps, this data was from json which I then used loadjsonfromstring that turned it into an object.

echo(temp.c.name);
echo(makevar("temp.c.name"));
echo(temp.c.(@name));

fowlplay4
07-10-2016, 09:00 PM
name is a built-in read-only variable which is why you're probably having issues.

use a different variable other than name in your json.

Kirko
07-10-2016, 10:25 PM
I can't change the variable names but I figured I would use savevarstoarray to turn it into an array. It's sorta confusing but it's alright.

Thank you

edit: When I turned it into an array I saw the name variable was actually called xmlname :(