Questions tagged [jsonresponse]

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

286 questions
1
vote
1 answer

django KeyError on live, works on station with pycharm

Ok so, following code "talks" to the same restapi from live host and from pycharm editor on local venv. Every other piece of code and other tones of requests works fine here and here. What is weird, follwoing code works from manage.py runserver…
gipcu
  • 265
  • 2
  • 14
1
vote
1 answer

'str' object has no attribute 'META' error while returning a JsonResponse

I want to return a JsonResponse/HttpResponse from my Django views function. However I am getting 'str' object has no attribute 'META' error. The code for the function is given below. def search(request): queryset_list =…
Ahmad Javed
  • 544
  • 6
  • 26
1
vote
2 answers

How to correct the format given by JsonResponse

I am printing the output from my views function in Django using JsonResponse and want to correct the output and only include certain fields.How should I proceed? The function is : influencers = Influencer.objects.all() influencer_data =…
Ahmad Javed
  • 544
  • 6
  • 26
1
vote
3 answers

How to use JMSSerializer with symfony 4.2

i am building an Api with symfony 4.2 and want to use jms-serializer to serialize my data in Json format, after installing it with composer require jms/serializer-bundle and when i try to use it this way : ``` demands = $demandRepo->findAll(); …
1
vote
2 answers

Can I add a json response when returning an MVC view with model?

Is there a way to add a JSON Result that would be consumed by the OnSuccess or OnFailure options of an AJAX.BeginForm when the controller is using the return View(model) syntax? Everything is pretty standard C# / MVC. The Ajax.BeginForm would look…
vscoder
  • 929
  • 1
  • 10
  • 25
1
vote
0 answers

NSURLSessionDataTask returning nil value after getting response

I created this api endpoint that sends back data about a person, and I'm trying to reach that endpoint from my app. I was able to connect to the endpoint but after calling that method it returns nil. I've attempted to use a block statement to…
1
vote
1 answer

How to place selected custom arraylist values to same custom arraylist but only up to 3 out of 5

Here from response i am getting total (getListOfPackages) planlist size 5 it having id numbers 2,3,4,5 and 6, But my requirement i have to display plan id 2,5 and 6 in one recyclerview and remaing in another recyclerview. I am not getting what i…
1
vote
2 answers

TypeError: 'GeoQuerySet' object is not callable

I am trying to create google map API 3 markers using users' locations in Geodjango. I encounter Internal Server Error 500 in rendering the google map and markers. On the CMD console , I get TypeError: 'GeoQuerySet' object is not callable. Can you…
Kaleab Woldemariam
  • 2,567
  • 4
  • 22
  • 43
1
vote
1 answer

Throw exception, but json response get status SUCCESS

I have this part of code in Controller, but when i make this action and IF works fine and the error message appears in console log. But it looks like 'success' has status true. And it shouldn't Try { if ($last['date']) { if…
1
vote
0 answers

How to decrypt JSON response using Swift 3?

I have Installed CryptoSwift framework by Pods. I am getting Encrypted data from server response. I am trying to do decrypt the data by using that below function: func aesDecrypt(key: String, iv: String) throws -> String { let data =…
Kishor Pahalwani
  • 1,010
  • 1
  • 23
  • 53
1
vote
1 answer

Pulling out value of keys in JSON using Java, when key is under hierarchy

I need to pull out value of RecordOne from following JSON. { "errors": [], "data": { "paging": { "RecordOne": 8, "RecordTwo": 9, "recordThree": 2, "totalNumberOfRecords": 86052 }, "products": [ { …
SSabharwal
  • 159
  • 12
1
vote
1 answer

Post request not working on Restful API Codeigniter

I have installed RESTful Codeigniter API on my Codeigniter project. When I test API Example and call through Chrome postman rest client by http://textilexports.com/donate/api/example/users url, I got that error in Post response. { "id": 100 …
1
vote
1 answer

Creating xml from API response

I have the following application for making a GET request which returns data in JSON format: class Program { static void Main(string[] args) { RunAsync().Wait(); } static async Task RunAsync() { using (var client…
Ferato
  • 15
  • 1
  • 4
1
vote
1 answer

How to search for nested values in Resources(tastypie json)

Hi I have the following resources inside respurces.py file. class SodResource(ModelResource): class Meta: queryset = Sod.objects.all().order_by('-rank') filtering = {'sod_type': ALL, 'generic_value': ALL} class…
vellattukudy
  • 789
  • 2
  • 11
  • 25
1
vote
1 answer

JSONException trying to extend JsonObjectRequest

I am running into a syntax problem but I can't figure out what is wrong. It seems like this thread has the answer but it does work for me. JSONException: Value of type java.lang.String cannot be converted to JSONObject I am using Volley I need to…
gmmo
  • 2,577
  • 3
  • 30
  • 56