Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: ujson labels are encoded twice #4593

Merged
merged 1 commit into from Aug 21, 2013

Conversation

@Komnomnomnom
Copy link
Contributor

commented Aug 17, 2013

With its current handling ujson ends up encoding labels twice, which can cause problems if they contain escapable characters:

In [16]: df = DataFrame([['a', 'b'], ['c', 'd']], index=['index " 1', 'index / 2'], columns=['a \\ b', 'y / z'])

In [17]: df
Out[17]: 
          a \ b y / z
index " 1     a     b
index / 2     c     d

In [18]: json = df.to_json()

In [19]: json
Out[19]: '{"a \\\\\\\\ b":{"index \\\\\\" 1":"a","index \\\\\\/ 2":"c"},"y \\\\\\/ z":{"index \\\\\\" 1":"b","index \\\\\\/ 2":"d"}}'

In [20]: pd.read_json(json)
Out[20]: 
           a \\ b y \/ z
index \" 1      a      b
index \/ 2      c      d

This PR fixes this behaviour so labels are only encoded a single time.

@jreback

This comment has been minimized.

Copy link
Contributor

commented Aug 21, 2013

ok to merge?

@Komnomnomnom

This comment has been minimized.

Copy link
Contributor Author

commented Aug 21, 2013

Yep, fire away!

jreback added a commit that referenced this pull request Aug 21, 2013
Merge pull request #4593 from Komnomnomnom/ujson-slash-happy
BUG: ujson labels are encoded twice

@jreback jreback merged commit 3644370 into pandas-dev:master Aug 21, 2013

@Komnomnomnom Komnomnomnom deleted the Komnomnomnom:ujson-slash-happy branch Aug 21, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.