avakar / pycson

A Coffescript Object Notation (CSON) parser for Python 2 and Python 3.
Other
55 stars 7 forks source link

Escaped quotes #8

Closed idleberg closed 8 years ago

idleberg commented 8 years ago

Converting the following JSON into CSON results in invalid CSON, since the quotes inside each string are not escaped.

JSON:

"mdi-access-point": {
  "body": "content: '\\F002';$1"
}

CSON:

'mdi-access-point':
  body: 'content: '\\F002';$1'

Either the outer quotes should be double-quotes (which is more common), or the inner quotes need to be escaped.

avakar commented 8 years ago

Hi, thanks for the issue!

Are you sure you're using the newest version (which is currently 0.7, you can upgrade with pip install --upgrade cson). Similar issue has been solved in #7 and I cannot reproduce this issue on my end.

The following json,

{
    "mdi-access-point": {
        "body": "content: '\\F002';$1"
    }
}

produces this cson for me:

'mdi-access-point':
    body: 'content: \'\\F002\';$1'

If you really have cson-0.7, can you post a minimal complete code example which reproduces the problem?

avakar commented 8 years ago

As there is no activity here, I'm closing the issue. Feel free to reopen if the problem persists.