Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
5 votes
0 answers
1k views

Exception handling: using @JsonProperty value to make error message

If the validation in RestController fails, I need to handle MethodArgumentNotValidException and provide an errorMessage, that ...
Georgii Lvov's user avatar
2 votes
1 answer
604 views

Modify original JSON few times and post http request

Follow up question from here. I am working on a project where I need to do below things in Python: Take few input parameters like - environmentName, ...
AndyP's user avatar
  • 239
8 votes
1 answer
287 views

Post json using http and verify whether all actions completed successfully or not

I am working on a project where I need to work with http apis and call them using Python language. Below is what I need to do: Take few input parameters like - <...
AndyP's user avatar
  • 239
4 votes
1 answer
789 views

Should my Json storage handle exceptions?

I made a class to conviniently serialize/deserialize data. Now I'm stuck with the following question. Should I handle exceptions (use try-catch) inside JsonStorage ...
Glitch's user avatar
  • 217
0 votes
2 answers
48 views

Printing the status of a database insertion as JSON

The controller is currently inserting a record into the database and returning a JSON response as shown below in the try-catch block. I can see the ...
John's user avatar
  • 195
0 votes
1 answer
290 views

Python client to fetch JSON data from REST API, retrying on failure

As a beginner, I'd like to see if anyone can suggest any better way of coding the below, as I'm duplicating code and nesting identical if statements as part of the following problem. I'm grabbing ...
mrgou's user avatar
  • 103
4 votes
2 answers
999 views

Fetching data through HTTP and caching JSON result in a file

The task is to fetch some JSON data from an API with a GET request. If the location is not available for any reason, read a cache file. Otherwise write the cache file for future use. The following ...
ProfHase85's user avatar
1 vote
1 answer
1k views

utility class for reading in JSON

I'm reasonably happy with the execution: ...
Thufir's user avatar
  • 369
5 votes
2 answers
2k views

Getting JSON data from an HTTP response using conditional binding

I am new to Swift and I am trying to use the optional binding feature in as efficient way as possible but I am a bit confused on how to use it (if I can) in this scenario: ...
frezq's user avatar
  • 159
2 votes
2 answers
2k views

Program to edit an address book stored as a JSON file

I'm trying my hand at an address book and the goal is for it to have a bit more of error prevention. For instance, for the key "phone" to have 10 digits, and not allow alpha characters at section 4. I ...
refinneJ's user avatar
2 votes
2 answers
220 views

RSS to JSON for insertion into MongoDB

In my code, there is a chain of functions call where the deepest function may throw an exception. I catch and handle it according to the business logic. The problem is that all other functions in the ...
Mike's user avatar
  • 277
0 votes
2 answers
440 views

Concatenating multiple strings from a JSON response

I would like to concatenate a series of strings populated from an XHR response. So, I've chosen to do it like this: ...
Chris's user avatar
  • 9
2 votes
0 answers
83 views

Restful API for parsing records

I'm trying to implement my own API. This code excerpt should show the basic working routines. The storage is temporary an in-memory-array and the only HTTP method for now is POST. I outsourced the ...
user3147268's user avatar
7 votes
2 answers
7k views

Handling parsing failure in Scala without exceptions

I have a Scala (Play!) application that must get and parse some data in JSON from an external service. I want to be able to gently handle failure in the response format, but it is becoming messy. What ...
Andrea's user avatar
  • 437
8 votes
3 answers
3k views

Catching multiple types of exceptions when writing JSON

I have a class which throws a lot of exceptions: ...
blue-sky's user avatar
  • 557