1

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.

2
  • Can you post your code? Commented Mar 6, 2014 at 10:23
  • @SpringBreaker I have edited with code. Commented Mar 6, 2014 at 10:33

2 Answers 2

1

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)));
Sign up to request clarification or add additional context in comments.

Comments

0

You could try setting those values to empty Strings, if it is suitable.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.