홈
블로그
책
포럼
It will seem like simplified English.
1 시간 전
몇 개의 언어의 문법을 결합한다면
3 분 전
As a skeptical Cambridge friend of mine occidental.
def json(request): import json data = {'team': 'Brazil', 'position': 1, 'host': True, 'lastGame': 'Win'} dictToJson = json.dumps(data) return HttpResponse(json.dumps(dictToJson), content_type="application/json") response = {'error': str(sys.exc_info()[1])} return HttpResponse(json.dumps(response), content_type="application/json")
def json_response(request): import datetime now = datetime.datetime.now() result = {} result.update( {'aaa' : 'aaaa'} ) result.update( {'bbb' : 'bbbb'} ) result.update( {'ddd' : 'dddd'} ) result.update( {'eee' : 'eeee'} ) result.update( {'time' : now} ) return JsonResponse(result)
def jsonfile(request): # return HttpResponse(open("data/static/FROALA_CHART/sample_json/CHART_COMP_pie.json", 'rb').read()) from django.conf import settings from django.http import JsonResponse p = os.path.join(settings.STATIC_URL, 'FROALA_CHART/sample_json/CHART_COMP_pie.json') getFile = open('data/static/FROALA_CHART/sample_json/CHART_COMP_pie.json', 'rb') json_data = getFile.read() return HttpResponse(json_data)
def jsonread(request): import json filePath = 'data/static/test/json/data.json' filePath = 'data/arbre/testjson/data.json' getDATA = json.load(open(filePath, encoding='utf-8')) html = '' for i in getDATA: html+= i + "<br/>" return HttpResponse(mark_safe(html))