Skip to content

Will json.dump() get the indent argument? #16296

Answered by Josverl
liudr asked this question in Core Development
Discussion options

You must be logged in to vote

There have been a few PRs to try to reduce the size of the generated json by omitting spaces #4294 , #7337
adding ident=4 would be inline with CPython , but I thing the code for that is non-trivial and will increase the firmware size.

Eve after that - there is a pitfall waiting to happen if you try to

  • write a file on the device
  • read , modify and save that from the host [ Assuming MSC ]
  • try to read it from your device

This is very likely to cause filesystem corruption , see #16012 for one of the recent conversations on this topic.

So my answer is : Quite unlikely

If you know something about the json structure, you may be able to save memory , and add indentation at the same time.
I have …

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@liudr
Comment options

@stinos
Comment options

@jgriesfeller
Comment options

@Josverl
Comment options

@liudr
Comment options

Answer selected by liudr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants