Sorry if this question has already been asked and answered. There doesn't seem to be a way to search the archives.
I'm using action=parse, format=json, and the result creates a JavaScript JSON object. The HTML I wish to use is in result.parse.text.*, and the problem is JavaScript detects a syntax error because of the property named "*". How can I work around this?
Thanks, Brendan
On Fri, Feb 8, 2013 at 9:02 AM, Brendan Taylor bftrock@gmail.com wrote:
I'm using action=parse, format=json, and the result creates a JavaScript JSON object. The HTML I wish to use is in result.parse.text.*, and the problem is JavaScript detects a syntax error because of the property named "*". How can I work around this?
Use the array-like syntax to access the property: result.parse.text['*']. You could even use result['parse']['text']['*'] if you really wanted.
http://www.ecma-international.org/ecma-262/5.1/#sec-11.2.1
mediawiki-api@lists.wikimedia.org