Understanding JSON objects and arrays in MT macros.

Doc requests, organization, and submissions

Moderators: dorpond, trevor, Azhrei

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Understanding JSON objects and arrays in MT macros.

Post by Azhrei »

TK wrote:
Craig wrote:So what you have to do is build the objects in pieces.
Makes sense, unfortunately since I'm putting this right in a macro link so building it up like that would be very difficult. Is there any plan to add in escape characters as a feature in future builds?
To be honest, no. We hope to move to javascript in the not-too-distant future, making the current macro syntax somewhat of a redheaded stepchild...

User avatar
Veggiesama
Dragon
Posts: 619
Joined: Wed Aug 29, 2007 1:18 am

Re: Understanding JSON objects and arrays in MT macros.

Post by Veggiesama »

TK wrote:Did some searching, my apologies if this is answered somewhere already.
Is there a way to escape the apostrophe ' character in a JSON object? I will likely need to escape the quote " character at some point too if possible.
Thanks
I have been doing a poor man's hack. If I need to deal with an apostrophe character in a JSON in a context that doesn't like apostrophes, I do replace(json, "'", "`") and then the reverse when I store the JSON again.

I replace a single-quote with back-quote (that key to the left of 1) because generally people don't use back-quotes for anything.
My D&D 4e Campaign FrameworkMy Shadowrun 4e Campaign Framework
RPGA#: 5223846427 — Skype: Veggiesama — Fear the ferret.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Understanding JSON objects and arrays in MT macros.

Post by Azhrei »

Veggiesama wrote:I replace a single-quote with back-quote (that key to the left of 1) because generally people don't use back-quotes for anything.
Heh, you're showing your U.S. bias by just assuming that the backtic is there. ;)

User avatar
Veggiesama
Dragon
Posts: 619
Joined: Wed Aug 29, 2007 1:18 am

Re: Understanding JSON objects and arrays in MT macros.

Post by Veggiesama »

Azhrei wrote:Heh, you're showing your U.S. bias by just assuming that the backtic is there. ;)
That's 'cuz I don't use no durn commie finger-punchin' board. I only use true red, white, and blue 'Merican English keyboards!

(made in Thailand)
My D&D 4e Campaign FrameworkMy Shadowrun 4e Campaign Framework
RPGA#: 5223846427 — Skype: Veggiesama — Fear the ferret.

Post Reply

Return to “Documentation Requests/Discussion”