We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
}
In 0.19.0 exporting json with new lines breaks if a string contains a closing curly brace.
import pandas as pd pd.DataFrame([{'a': 'foo}', 'b': 'bar'}, {'a': 'foo2', 'b': 'bar2'}]).to_json(orient='records', lines=True) '{"a":"foo}"\n"b":"bar"},{"a":"foo2"\n"b":"bar2"}'
'{"a":"foo}","b":"bar"}\n{"a":"foo2","b":"bar2"}'
pd.show_versions()
commit: None python: 2.7.12.final.0 python-bits: 64 OS: Darwin OS-release: 16.0.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8
pandas: 0.19.0 nose: None pip: 8.1.2 setuptools: 27.2.0 Cython: 0.24.1 numpy: 1.11.2 scipy: 0.18.1 statsmodels: None xarray: None IPython: 5.1.0 sphinx: None patsy: None dateutil: 2.5.3 pytz: 2016.7 blosc: None bottleneck: 1.1.0 tables: 3.2.3.1 numexpr: 2.6.1 matplotlib: 1.5.3 openpyxl: 2.4.0 xlrd: None xlwt: None xlsxwriter: None lxml: 3.6.4 bs4: 4.5.1 html5lib: 0.999 httplib2: 0.9.2 apiclient: 1.5.3 sqlalchemy: None pymysql: None psycopg2: 2.6.2 (dt dec pq3 ext lo64) jinja2: 2.8 boto: 2.42.0 pandas_datareader: 0.2.1
The text was updated successfully, but these errors were encountered:
Note that this bug is inly present with lines=True (new feature in 0.19.0), with the default it works correctly:
lines=True
In [50]: pd.DataFrame([{'a': 'foo}', 'b': 'bar'}, {'a': 'foo2', 'b': 'bar2'}]).to_json(orient='records') Out[50]: '[{"a":"foo}","b":"bar"},{"a":"foo2","b":"bar2"}]'
@joshowen Thanks for the report!
cc @aterrel
Sorry, something went wrong.
286b9b9
BUG: fix json with lines=True for quoted special characters
04023d2
closes pandas-dev#14391 closes pandas-dev#14390
Successfully merging a pull request may close this issue.
In 0.19.0 exporting json with new lines breaks if a string contains a closing curly brace.
Example
Expected Output
'{"a":"foo}","b":"bar"}\n{"a":"foo2","b":"bar2"}'
Output of
pd.show_versions()
commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Darwin
OS-release: 16.0.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.19.0
nose: None
pip: 8.1.2
setuptools: 27.2.0
Cython: 0.24.1
numpy: 1.11.2
scipy: 0.18.1
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.7
blosc: None
bottleneck: 1.1.0
tables: 3.2.3.1
numexpr: 2.6.1
matplotlib: 1.5.3
openpyxl: 2.4.0
xlrd: None
xlwt: None
xlsxwriter: None
lxml: 3.6.4
bs4: 4.5.1
html5lib: 0.999
httplib2: 0.9.2
apiclient: 1.5.3
sqlalchemy: None
pymysql: None
psycopg2: 2.6.2 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: 2.42.0
pandas_datareader: 0.2.1
The text was updated successfully, but these errors were encountered: