make json viewer more clear (reopen)
reopened #2334
I propose:
- Storing json_string, with 'from' being changed to 'from_user'
- When printing an object, this json_string should be printed.
And then, we can add some JSON_FORMATTED = FALSE or something like this to types.
@Badiboy need your opinion. This way, users will be able to see a CLEAR response from Telegram.
This way, users will be able to see a CLEAR response from Telegram.
Debug mode have full and clear responces of the Telegram.
- Storing json_string, with 'from' being changed to 'from_user'
I have no willing to waste my and others server resources for storing json strings that I never used before and will never use in future for the only purpose that one guy after several years of library existence occasionally decided to have pretty output.
Except you will make it SO OPTIONAL that it will affect NOBODY except they obviously decided to use it.
I have no willing to waste my and others server resources for storing json strings
Makes sense
We still need changes to the output of the types though; Then, we can stick to the current implementation, but with pretty-printing optional. I have personally encountered parts where outputting classes is SO annoying: 99% of values shown are None. I have to turn debug afterwards. While debug is still needed, I see it reasonable to remove None values by default; And make pretty-printing optional by default.
I have nothing against pretty output as I said from the very beginning which is:
- Optional
- Not consuming resources for those who do not need it
Intermediate version that was discussed that allowed:
- Optionally enable pretty output
- Optionally disable NONEs
Looked fine for me.
Is disabling Nones by default fine with you?
Mmm... Let's be like that as far as Nones are really useless and it should be more or less clear that if you do not see property - it's empty.
Well I don't see any use case for seeing Nones. They are useless as API does not provide them. They just take up space, nothing useful out of this.
Allright! @2ei then could you please:
Create 2 variables:
- JSONDESERIALIZABLE_PARSE_OUTPUT = False
- JSONDESERIALIZABLE_SKIP_NONE = True
Use these to pretty print and output None values if necessary.
@coder2020official Done
Aslo, what about adding
JSONDESERIALIZABL_PARSE_INDENT = 2
too?
@badiboy do you think parse indent is this necessary
parse indent
What's that?
@2ei just implement it, won't hurt
Thanks for the PR. Will test it out ASAP
@2ei Thank you. LGTM if pass tests. )
Romoving json looks reasonable: no need to duplicate the same data.
Romoving json looks reasonable: no need to duplicate the same data.
what should i do in your opinion?, convert json parameter to property method or just make an condition in JsonDeserializable ?
Also i just noticed that there is no type hint for json parameter, on my way to add it too.
LGTM. What did we agree on json?
Romoving json looks reasonable: no need to duplicate the same data.
what should i do in your opinion?, convert
jsonparameter topropertymethod or just make an condition inJsonDeserializable?Also i just noticed that there is no type hint for json parameter, on my way to add it too.
idk, i have 2 suggestions here, what is the best one for you @coder2020official ?
@badiboy this has been on for a long time. do you think we should convert json to property?