com.couchbase.lite.CouchbaseLiteException: Bad or missing JSON
this error occurs when i try to use putProperties().
Made a HashMap Type Object and then call that putProperties Method with HashMap Object as an argument like below
Map<String, Object> documentBody = new HashMap<String, Object>();
documentBody.put(“key”, ownClass Object);
Document document = database.createDocument();
document.putProperties(documentBody);
then Error Pops up
Error seems like cannot encode to JSON type… am I right?
I googled for hours and cannot find any clue… So please!!! Help me ~!
Probably Jackson found the ClassB object first and threw an exception, without seeing the ClassA object.
Anyway, is there any possible way to serialize JSON String from Own Class Object?
Take a look at the Jackson documentation. Or you can always create a Map from the data in the object and serialize that instead. Jackson isn’t a Couchbase library, it’s just what we use for JSON conversion in Java.