Questions tagged [jsonresponse]

Provides simple classes for JSON responses that adhere to a standardized structure.

286 questions
1
vote
2 answers

How to view responses from two JSON API into single recycler view adapter by matching ids from both APIs?

I am getting responses from two different JSON API's where a id object is common in both the API's. I want to know how many times does a id from first response occurs in second response. like if id="642" from first response occurs two times in…
1
vote
1 answer

how to use axios to capture http json response and pass value to another function?

I am trying to perform a GET call in typescript to various services and capture a value from their json response which will be passed in as a param in another function. Through some online searching, I bumped into axios but am having a hard time…
1
vote
1 answer

Django: AttributeError at /update_item/ 'WSGIRequest' object has no attribute 'data'

The following error is given to me when i access my localhost:8000/update_item/: "AttributeError at /update_item/ 'WSGIRequest' object has no attribute 'data'" views.py def updateItem(request): data = json.loads(request.data) productId =…
MateoG98
  • 183
  • 11
1
vote
1 answer

How to send error message to the Django generic DeleteView Confirmation Page using JsonResponse

I am trying to use Django generic DeleteView using the confirmation page. The setup is working as intended. Later the business logic was changed to prevent deletion if there are child instances assigned to the object being deleted, using…
shaan
  • 351
  • 2
  • 15
1
vote
3 answers

Json Response needs to update Javascript value and replace global initial global value - work around solution needed

I'm trying to wrap my head around the fetch api and get. From what i've been studying it looks like its suppose to be easy but my mind isn't getting it fully. In my game Javascript, it starts with a money=2000 global variable. The game plays fine,…
Ed Nolan
  • 62
  • 7
1
vote
1 answer

Django JsonResponse converts numbers to string

I'm using JsonResponse(status=200, data=) to return from my Django backend API. However, upon inspecting the result of this, all number values get converted to strings (these values are the value portion of the dict, not key).…
user1056585
  • 682
  • 1
  • 7
  • 21
1
vote
1 answer

Django manytomany fields are not included in api call

models: class Light(models.Model): name = models.CharField(max_length=255, default="neues Licht", null=False, blank=False) percentage = models.IntegerField(default=0, null=False, blank=False) def __str__(self): return self.name …
Nikolas
  • 15
  • 4
1
vote
1 answer

Django HttpResponse in JsonResponse

In my django project in order to avoid another request I would like to return a JsonResponse with a HttpResponse in there like this: JsonResponse({"known": True, "space": render(request, 'space.html')}, status=200) Django process returns the normal…
1
vote
1 answer

alert success bootstrap for json_encode response

i have 2 conditions that return as json like this public funtion do_upload{ //1st return json_encode(['upload_success' => 'Successfully import ' . $count_validEntries . ' document]); //2nd return json_encode(['upload_error' => 'Your document is not…
pramudityad
  • 57
  • 1
  • 8
1
vote
1 answer

Parsing Failed: JSONDecoder Swift

I'm trying to decode a json request using Alamofire 5.2 The problem is that I use JSONDecoder and I have some issues about the conversion The API is in Spanish and my models in English so I decided to changed this kind of values using an enum of…
Antonio Labra
  • 1,694
  • 2
  • 12
  • 21
1
vote
2 answers

Django rename column when multiple tables are joined

I have this class in models.py: class Customer(models.Model): code = models.CharField(unique=True, max_length=10) user = models.OneToOneField(User, on_delete=models.PROTECT) phone = models.CharField(max_length=20) address =…
arash
  • 11
  • 2
1
vote
0 answers

Symfony JsonResponse not maintining array order

I've a first function which returns an array with a specific order (see the picture below). private function getScenarioPartners(Request $request){ $users = array(); /.../ uasort($users,array($this,"userComparison")); return…
KubiRoazhon
  • 1,759
  • 3
  • 22
  • 48
1
vote
1 answer

{"d":null} append in ASMX Web Service respone

I am calling a web service method which return boolean value in json. But on front end i am getting response true{"d":null}. {"d":null} is appending in response. Following is my web service code [WebMethod] public void CreateTeam(tblTeam…
Hunzla Ali
  • 61
  • 1
  • 9
1
vote
0 answers

Unable to get parameters from JSONRPC2Response java

I am trying to make some JSON RPC calls using the JSONRPC2 java library.I successfully managed to make the request and obtain the response result using response.getResult() which returns: "balance": [ { "asset_hash":…
1
vote
1 answer