Link to home
Start Free TrialLog in
Avatar of hankknight
hankknightFlag for Canada

asked on

JavaScript: Use anything for object property name including spaces and quotes

I want to be able to use ANYTHING for a JavaScript property name, including unicode characters, spaces and quotes.

For example:
ß¿¿
¿¿
Hello World
test "123"

How can I do this?

var doc=new Object();

doc.Hello=1;
doc.World=2;
doc.¿ß¿ss¿¿=3;
doc.¿¿=4;
doc.Hello World=5;
doc.test "123"=6;

alert( JSON.stringify(doc) );

Open in new window

Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Not going to happen.  Some characters might work, but not all.  space not a chance. quote character no chance.  Any character that is an operator... not going to happen.

Dead end, you will need to go back to the drawing board, because this is not going to happen.

Cd&
Avatar of hankknight

ASKER

Where can I find documentation about specifically what characters are allowed or not allowed?
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial