Is there a library that can format JSON-unsupported Python data types for JSON encoding/decoding? /u/OhGodSoManyQuestions Python Education

I’m updating JSON code that passes a lot of unpredictable data between Python scripts on different computers. And also sometimes JavaScript clients in browsers.

I’m looking for a cleaner way to escape/substitute all of the illegal characters and sequences (newline, Unicode, escapes, etc).

And I’d like to add some tags to some unsupported data types to make restoration on the receiving end less ambiguous. For instance, adding tags to encoded numpy arrays or datetime data to provide clues for restoring them after they are loaded from JSON.

It seems like there should be a general solution for this, since it’s a problem for everybody and Python has no default data serialization scheme. But I’m not finding one. Am I looking in the wrong place?

quick disclaimer: I am not using pickle because of the security problem and the need to use the same data in web browsers. And while YAML solves a few of these problems, it doesn’t solve them all and it’s an external dependency for both Python and JavaScript.

submitted by /u/OhGodSoManyQuestions
[link] [comments]

​r/learnpython I’m updating JSON code that passes a lot of unpredictable data between Python scripts on different computers. And also sometimes JavaScript clients in browsers. I’m looking for a cleaner way to escape/substitute all of the illegal characters and sequences (newline, Unicode, escapes, etc). And I’d like to add some tags to some unsupported data types to make restoration on the receiving end less ambiguous. For instance, adding tags to encoded numpy arrays or datetime data to provide clues for restoring them after they are loaded from JSON. It seems like there should be a general solution for this, since it’s a problem for everybody and Python has no default data serialization scheme. But I’m not finding one. Am I looking in the wrong place? quick disclaimer: I am not using pickle because of the security problem and the need to use the same data in web browsers. And while YAML solves a few of these problems, it doesn’t solve them all and it’s an external dependency for both Python and JavaScript. submitted by /u/OhGodSoManyQuestions [link] [comments] 

I’m updating JSON code that passes a lot of unpredictable data between Python scripts on different computers. And also sometimes JavaScript clients in browsers.

I’m looking for a cleaner way to escape/substitute all of the illegal characters and sequences (newline, Unicode, escapes, etc).

And I’d like to add some tags to some unsupported data types to make restoration on the receiving end less ambiguous. For instance, adding tags to encoded numpy arrays or datetime data to provide clues for restoring them after they are loaded from JSON.

It seems like there should be a general solution for this, since it’s a problem for everybody and Python has no default data serialization scheme. But I’m not finding one. Am I looking in the wrong place?

quick disclaimer: I am not using pickle because of the security problem and the need to use the same data in web browsers. And while YAML solves a few of these problems, it doesn’t solve them all and it’s an external dependency for both Python and JavaScript.

submitted by /u/OhGodSoManyQuestions
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *