Django get wrong value from json.loads in POST request
I need to pass a user-input geojson with request to further process the information. The data comes from a textfile and then passed to the views.py in django with a POST request. Before passing to the view I checked the value of the string and that appears to be correct. After passing that to the view, I made a print check and some values inside the JSON are changed in string like:
"{"id": "13871", "type":SOH@ "Feature", "properties": {"lanes": 0, "highway": "pedestrian" etc....." or "{"id":"86","type":"FeatureSOHVT","properties":etc......."
The bold strings sometimes appear even inside the values of the dictionary.
The js file:
$.ajax({
type: 'POST',
url: $('#confImp').data('url'),
dataType: 'json',
data: {'streetWeb': JSON.stringify(street_web), 'int_points': JSON.stringify(int_points_loaded), 'csrfmiddlewaretoken': csrftoken,},
success: function(res){blablabla}
The django views.py:
elif 'streetWeb' in request.POST:
print(json.loads(request.POST.get('streetWeb')))
request.session['Working_area_final'] = json.loads(request.POST.get('streetWeb'))
print(json.loads(request.POST.get('int_points')))
request.session['int_points'] = json.loads(request.POST.get('int_points'))
return JsonResponse({'Risposta': 'Done'})