• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Json
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Json


  • Subject: Re: Json
  • From: has <email@hidden>
  • Date: Tue, 17 Feb 2015 18:55:13 +0000

Shane Stanley wrote:

>> All slashes in text content will be escaped
>>
>> Of course I can have a simple search & replace handle to take care if that – but can I instead tweak the Cocoa-related parts of the JSON export handler?
>
> No, there is no such option. As far as I can see, escaping of slashes is optional. The only thing I can find are suggestions that some real-world implementations require it. All I can suggest is building in the search and replace, like this:
>
> set someString to someString's stringByReplacingOccurrencesOfString:"\\/" withString:"/"

Don't do that, it\\\/s unsafe.


Also, there's absolutely no reason to strip backslash escapes from slashes (no unless one is spectacularly OCD). While escaping slashes is only actually needed when embedding JSON code inside <script>...</script> elements, they are always syntactically valid. (See <http://json.org> for a description of JSON syntax.)

If the "JSON" parser consuming the OP's data is choking on these escaped slashes, the OP should file a bug report because that parser is defective [1], and/or switch to using a JSON parser that works right.

Regards,

has


[1] (No small feat, considering JSON's one of the simplest data formats ever devised. Then again, "Web Industry".)

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


  • Follow-Ups:
    • Re: Json
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Json
  • Next by Date: Re: Json
  • Previous by thread: Re: Json
  • Next by thread: Re: Json
  • Index(es):
    • Date
    • Thread