JSON API | Thales IoT Developer Community
March 27, 2017 - 3:21pm, 4433 views
Hello,
I will make http connection to a web server.
The data will be sent to/ received from server in JSON format. I'm searching a JSON api for this purpose.
There are reliable JSON APIs that can be used in Java SE but not much for J2ME.
Do you know any reliable, recommended JSON API for J2ME which can be used with BGS5?
Best Regards,
Ergün.
Hello,
I have found this one https://github.com/greyson/j2me-json but I haven't used it. It's quite old.
If anyone is good enough you may need to adopt some library.
Here's for example a showcase with the adopted MQTT library: https://iot-developer.thalesgroup.com/showcase/paho-project-110-july-201...
Regards,
Bartłomiej
Hello Bartlomiej,
Thanks for the answer.
Adopting can be done but much time and effort is needed for it.
I will try the source you sent from github. I have found another similar to yours. It is below.
https://bitbucket.org/liedman/json-me
I haven't investigated in detail yet but they seem similar. Package names in source codes are json.org.me. Probably, original source for Java SE of it is that:
https://github.com/stleary/JSON-java
I hoped to find more reliable source special for j2me. By a developer community or company (maybe gemalto).
Oracle, Java ME 8.0 has a library for json.
http://docs.oracle.com/javame/8.0/api/json/api/index.html
http://www.oracle.com/technetwork/java/embedded/javame/embed-me/document...
Best Regards,
Hello Bartlomiej,
A user in this forum seems has used json.me.org api in a TC65 project. Github link of it here:
https://github.com/fclairamb/org.json.me.tc65
I found json.me.org jar here but it gave an error when creating package. Error is related to obfuscating.
http://www.java2s.com/Code/Jar/j/Downloadjsonmejar.htm
Problem with this source is its original web address gives 404 Not Found Error.
I think, this API was developed by Sun Microsystems before it acquired by Oracle. I have found a reference to it in a blackberry web address.
http://www.blackberry.com/developers/docs/6.0.0api/org/json/me/package-s...
Hello Euyar,
It seems to me that these all projects were based on the same Java SE code.
For the tc65 project there is also a source code.
Isn't it that the error is because you have not checked the jar file for export in Eclipse?
Regards,
Bartłomiej
Hello Bartlomiej,
Yes, you are right. These projects coming from same source. But there are 2 versions: one for Java SE and other one for J2ME.
The web links about j2me api generally old, not up to date. So there is a doubt on correctness of them. I will use one of them by assuming the original source is not changed.
Regarding eclipse error, I checked the jar file under "Order and Export" tab. The reason of error is not unchecking. The jar file on below link has an error in it. I decompiled the jar. In JSONArray class, there is a compilation error.
http://www.java2s.com/Code/Jar/j/Downloadjsonmejar.htm
I have created jar file myself by using source codes and tested with that jar. In that case, there was no error.
Thanks.
Best Regards,
Hello,
Whatever way you choose you will need to test the library if it works well for your solution.
As for the jar file - maybe the classes were compiled with the wrong JDK compliance level or there was something else.
Regards,
Bartłomiej