limoncello-php / app

Quick start JSON API application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use of jsonapi on mobile apps

dreamsbond opened this issue · comments

I know it should not be covered in whether or not to use jsonapi as back-end in mobile apps.

Like Android or ios

But I really want to seek for your opinion @neomerx that will jsonapi be a right backend for it?

Will it be a bit too complex and clumsy on the structures and size of the data returns.

In my opinion, JSON API is very good for mobile apps. You've mentioned 2 concerns:

  • complex data structures
  • data size

JSON API makes it possible to have multiple data types in one response with relationships between them. Why is this important? Because you can have just one request-response for complex data. If an app uses simple data structures it will need more than one request. For mobile, every additional request means huge latency. So JSON API is great for that.

As for data size, I don't see it as a big problem. Just remove JSON_PRETTY_PRINT option from \Settings\ApplicationApi and put gzip on; for nginx (or an equivalent for apache). It will reduce the data 5-10 times which is next to nothing.

I have discussed with some Android and iOS developers
They were hesitate to work with jsonapi as the back-end.
They do not think jsonapi were not good enough to work with majority on the parsing and attributes, and relationship mapping on the front-end, where they used to work with native json structures.

For sure. I really love jsonapi. It brings me a very rigid database schema and full crud capabilities.
Having separate back-end (json) for mobile app was really a headache. That is what jsonapi and limoncello saved me a lot. But the mobile developers were somehow reluctant to work with it.

Thanks for your opinion!

You should separate technical issues from human ones. You shouldn't be surprised that not all people like to learn. JSON API could be as simple as plain JSON. Just give them 20 line JS that does the job an make them happy.