zolekode / json-to-tables

Convert any JSON File to Normalised tables
GNU General Public License v3.0
15 stars 2 forks source link

Boolean and null normalization support #2

Closed macpreet closed 2 years ago

macpreet commented 2 years ago

I tried to use your code. It reads null values in json and stores it in sql by replacing with NONE(python). As per my requirement, we need null to be stored as it is in sql. Any help would be appreciated. Thanks

samos667 commented 2 years ago

Exactly the same thing for me !

Some logs: image

json used: https://api.themoviedb.org/3/movie/500?api_key=

null value need to be None true to True false to False

@zolekode you know a method to fix it without rewrite the json ?

i will try some fix in my way, i'll keep you informed

samos667 commented 2 years ago

@macpreet i think* title need to be set to "Boolean and null normalization support"

macpreet commented 2 years ago

@macpreet i thing title need to be set to "Boolean and null normalization support"

Done.

macpreet commented 2 years ago

Closed the issue by mistake . Sorry

zolekode commented 2 years ago

@samos667 regarding the screenshot you shared, you need to pass a dictionary (python dict) instead of a json. You will probably first need to do something like import json json.loads(your_json)

zolekode commented 2 years ago

@macpreet @samos667 could you reexplain with the help of examples and screenshots? I am not very certain if I understand what you need.

zolekode commented 2 years ago

Issue should be fixed. @samos667 @macpreet

To solve both your problems:

table_maker.save_tables(..., cast_none_to_nan=True, cast_object_to_bool=True)
zolekode commented 2 years ago

Please leave a star and share the love of open source @samos667 @macpreet

macpreet commented 2 years ago

Thanks for your help @zolekode