simplejson

    2熱度

    1回答

    Input : {"id": null, "type": null, "order_for": null, "name": "Name"} 代碼: input_map = simplejson.dumps(eval(line)) print type(input_map) 回報 <type 'str'> 什麼在這裏錯了嗎? 謝謝

    2熱度

    2回答

    GAE上的django.utils.simplejson版本是例如在執行js = json.dumps(my_dict_w_strings_w_newline_and_slash)時轉義「/」字符,但不是「\ n」,當我嘗試在其他位置的客戶端中嘗試json.loads(js)時,會導致問題。 關於如何整理解決方案的任何建議?這些字符串是base64編碼的數據,因此被破壞。

    1熱度

    1回答

    我試圖使用simplejson解析一個JSON字符串。出於某種原因,當我使用simplejson.loads我收到以下錯誤: ERROR:root:Exception in request: Traceback (most recent call last): File "C:\django\lokus_web_new\django\core\handlers\base.py", line 1

    1熱度

    1回答

    我已經將json數據加載到api_result變量。現在我需要提取特定的字段(name,surname,city等)。我應該如何確認他們是否在那裏? api_result = json.loads(some_json_data) if api_result.get('name'): # do something with name if api_result.get('surname

    6熱度

    2回答

    我想一個Python數組編碼爲使用JSON simplejson.dumps: In [30]: s1 = ['test', '<script>'] In [31]: simplejson.dumps(s1) Out[31]: '["test", "<script>"]' 工作正常。 但我想打電話simplejson.dumps之前,首先躲過字符串(使用escapejs從Django中)

    0熱度

    1回答

    我(主要是試圖學習python和json,而且)試圖定期從twitter推出和格式化熱門話題列表。我一起拼湊了許多不同的教程。它服務於我的目的 - 打印我需要標準輸出的HTML,但我想知道如果我可以考慮不同的對象或更好地構造它。助攻? class trend: #these are the fields that Twitter provides, so they make up on

    4熱度

    3回答

    我想從網頁發送數據到Django視圖保存爲序列化JSON到數據庫。如果可能的話,我想避免django的QueryDict對象,只是用simplejson讀取請求,拼合並保存到數據庫。發送數據的最佳方式是什麼,這樣simplejson可以將它變平? var languages = {}; languages['english'] = ['mark', 'james']; languages['s

    1熱度

    1回答

    我有一個從simplejson.load()函數返回的數據字典(?)。它看起來像這樣... {'status': 'OK', 'results': [{'geometry': {'location_type': 'APPROXIMATE', 'bounds': {'northeast': {'lat': 53.86121, 'lng': -2.045072}, 'southwest': {'lat

    0熱度

    1回答

    我想顯示一個隨機鏈接+它的名稱從一個RSS提要。 我使用的代碼是: def updateFeed(url): query_args = { 'q': 'http://news.google.com/?output=rss', 'v':'1.0', 'num': '15', 'output': 'json' } qs = urllib.urlencode(query_args)

    1熱度

    1回答

    可能重複: json and simplejson module differences in Python 在this page about json,我也讀到了JSON和可用於JSON的Python模塊。提及那四個庫: Json在Python標準庫中。 simplejson。 pyson。 Yajl-PY 哪一個建議?標準庫和simplejson庫的主要區別是什麼?