Skip to content

ENH: Ignore flattening certain keys in json_normalize #27241

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

Closed
bhavaniravi opened this issue Jul 5, 2019 · 3 comments
Closed

ENH: Ignore flattening certain keys in json_normalize #27241

bhavaniravi opened this issue Jul 5, 2019 · 3 comments
Labels
Enhancement IO JSON read_json, to_json, json_normalize Nested Data Data where the values are collections (lists, sets, dicts, objects, etc.).

Comments

@bhavaniravi
Copy link
Contributor

bhavaniravi commented Jul 5, 2019

Sub issue of #23843

Code Sample, a copy-pastable example if possible

data = [{"CreatedBy":{"Name": "User001"}, 
        "Lookup":{"TextField":"Some text"},
        "Image":{"a":"b"}}]
json_normalize(data).to_json(orient="records")

Current Output

[{"CreatedBy.Name":"User001",
"Image.a":"b",
"Lookup.TextField":"Some text"}]

Problem description

A usecase where I don't want to flatten they dict under the key Image

Expected Output

[{"CreatedBy.Name":"User001",
"Image:{a":"b}",
"Lookup.TextField":"Some text"]

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
pandas: 0.23.4
pytest: None
pip: 18.1
setuptools: 39.1.0
Cython: None
numpy: 1.15.1
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 3.0.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@bhavaniravi
Copy link
Contributor Author

I would like to contribute the same as I did for #26876

@WillAyd WillAyd added the IO JSON read_json, to_json, json_normalize label Jul 5, 2019
@WillAyd WillAyd added this to the Contributions Welcome milestone Jul 5, 2019
@WillAyd
Copy link
Member

WillAyd commented Jul 5, 2019

Sounds good - PRs welcome!

@mroeschke mroeschke added the Bug label May 8, 2020
@mroeschke mroeschke added Enhancement and removed Bug labels Jul 10, 2021
@simonjayhawkins simonjayhawkins changed the title Ignore flattening certain keys in json_normalize ENH: Ignore flattening certain keys in json_normalize Jun 2, 2022
@simonjayhawkins simonjayhawkins added the Nested Data Data where the values are collections (lists, sets, dicts, objects, etc.). label Jun 2, 2022
@mroeschke mroeschke removed this from the Contributions Welcome milestone Oct 13, 2022
@mroeschke
Copy link
Member

Thanks for the request, but it appears this feature request hasn't gain much traction in years so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO JSON read_json, to_json, json_normalize Nested Data Data where the values are collections (lists, sets, dicts, objects, etc.).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants