File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -1730,7 +1730,7 @@ JSON
17301730``` python
17311731import json
17321732< str > = json.dumps(< object > , ensure_ascii = True , indent = None )
1733- < object > = json.loads(< str > )
1733+ < object > = json.loads(< str > ) # Raises ValueError on malformed string.
17341734```
17351735
17361736### Read Object from JSON File
Original file line number Diff line number Diff line change 15541554
15551555< div > < h2 id ="json "> < a href ="#json " name ="json "> #</ a > JSON</ h2 > < pre > < code class ="python language-python hljs "> < span class ="hljs-keyword "> import</ span > json
15561556<str> = json.dumps(<object>, ensure_ascii=< span class ="hljs-keyword "> True</ span > , indent=< span class ="hljs-keyword "> None</ span > )
1557- <object> = json.loads(<str>)
1557+ <object> = json.loads(<str>) < span class =" hljs-comment " > # Raises ValueError on malformed string. </ span >
15581558</ code > </ pre > </ div >
15591559
15601560< div > < h3 id ="readobjectfromjsonfile "> Read Object from JSON File</ h3 > < pre > < code class ="python language-python hljs "> < span class ="hljs-function "> < span class ="hljs-keyword "> def</ span > < span class ="hljs-title "> read_json_file</ span > < span class ="hljs-params "> (filename)</ span > :</ span >
You can’t perform that action at this time.
0 commit comments