Tag Info

New answers tagged

3

The purpose of a JSON Web Token is to authenticate you, not to secure the payload. Securing the payload is a separate operation. Naturally, you can encrypt the payload if you wish, but that's not the purpose of a JSON Web Token. You don't encrypt the payload for the same reasons that you don't encrypt anything else: the cost (however small it is) exceeds ...


1

It mostly depends on the size of the data you return and whether the user is expected to use all the data at once. For instance, if it's a list containing hundreds of thousands of complex entries: The response served as a single JSON will be rather large, and: It is unlikely that the user will actually need to see all the data at once. Instead, the user ...


-1

Like others, I will question the need for C++. If you consider JAVA programming, instead of C++ (Meanwhile, I enjoy programming in ANSI-C, but I think your priority is a rapid development, instead of the joy of programming). Please check the site http://www.json.org/java/ Actually http://www.json.org/java/ might give you also some ideas for C++ libraries. ...


1

You could consider changing the value for updated_properties to an object instead of an array and list the new value right in the list of updated properties. This will reduce the overall size of the message. { "event": "update", "appointment_id": 123, "updated_properties: { "place": "some new location", "time": "some new time" ...


6

From the comments... if everything else you have is C++ then the best answer is to write it in C++, building a mish-mash of different bits of programming languages is a right PitA to maintain and support. So, if you have C++ and need to resolve XML to JSON, it seems obvious to use the xml2json library that you linked to. It comes with sources so you can ...


6

There is no theoretical limit to how deep JSON objects can be nested, but there usually is a practical limit based on the decoder being used. For example, PHP's json_decode() has a default limit of 512 levels, though it can be adjusted. Read the documentation for the code using the JSON to determine the max depth. If your JSON is actually hitting depth ...


3

404 is perfectly fine for this use case. 4xx status codes are client error codes, so browser treats them as such, and that is perfectly fine too. Another kind of APIs (e.g. JSON-RPC) use different approaches, but since you're going RESTful, do not change response code just to make console output look pretty - it is not a use case, users are not supposed to ...


1

Should write and read parts be methods in a same class? I would disagree with this because reading and writing are two separate responsibilities and if you want to follow good practices such as Single Responsibility Principle, I would separate them out into two classes. It might seem like an overkill but you will see that with your code growing in the ...



Top 50 recent answers are included