Reputation: 62419
I want to send JSONObject
from mobile to server in Android
. There are some null
values which also i want to send.
I have tried following both way but its SKIPPING NULL
values.
tempJsonValuesOrder.put(DatabaseHelper.ORDER_OTHERS, orderCursor.isNull(orderCursor.getColumnIndex(DatabaseHelper.ORDER_OTHERS)) ? null :orderCursor.getString(orderCursor.getColumnIndex(DatabaseHelper.ORDER_OTHERS)));
Is there any way to put null
value in JSONObject
?
Help will be appreciated.
Upvotes: 1
Views: 222
Reputation: 62419
After all i found solution like:
tempJsonValuesOrder.put(DatabaseHelper.ORDER_TRANSPORT, orderCursor.isNull(orderCursor.getColumnIndex(DatabaseHelper.ORDER_TRANSPORT)) ? "" :orderCursor.getString(orderCursor.getColumnIndex(DatabaseHelper.ORDER_TRANSPORT)));
Upvotes: 1
Reputation: 426
You could try setting those values to empty Strings, if it is suitable.
Upvotes: 0