In Python 2.7, I am creating a JSN string (API call return) which lists unanswered threads. The way I have it now, each thread is an array element. It is not a problem for me but I am trying to improve my coding and I am surprised that this Jason String is properly formatted / formatted or it Can the format be improved?
{"unadvised_threads": [{"thread_id": 174, "author_username": "bp", "latest_post_date": "2014-02-18T03: 37: 21.67", "latest_reply_account ": 684," URL ":" https://community.com/products/t/334.aspx "," answer count ": 2," forum_id ": 18," author_name ":" abp "," subject ": "Latest_replace_iether": 649, "url": "", "user-name": "wigv", "latest_post_date": "2014-02-18T02: 13: 29.183", "latest_replace_error": "storage app"}, {"thread_id" Https: /community.com/products/t/375.aspx "," answer count ": 2," forum_id ": 45," author_name ":" wigsv "," subject ":" configuration - RPC-2.1 "}] }
In this way I am this Jason St Generate string:
Say it's valid. I usually end up with something close to this:
{"unanswered_threads": [{"thread_id": 174, "author_username": "bp", "latest_post_date": " 2014-02- 18T03: 37: 21.67 "," latest_repl_yyther ": 684," URL ":" https://community.com/products/t/334.aspx "," answer count ": 2," forum_id ": 18 , "Author_name": "abp", "subject": "storage app"}, {"thread_id": 335, "author_username": "widget", "latest_post_date": "2014-02-18T02: 13: 29.183" "Latest_Reply_Author": 649, "url": "https://community.com/products/t/375.aspx", "answer count": 2, "forum_id": 45, "author_name": "wigsv", "poison ":" Configuration - RPC-2.1 "}]}
but the difference is low: :
after the distance and on a line }] < / Code>.