• Post Reply Bookmark Topic Watch Topic
  • New Topic

json maaping question  RSS feed

 
david dabush
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to differ between fields that are not exists to fields that are null?
because in my api when someone wants to delete a field he sends null instead of a value. and if he doesnt want to effect this feild he doesnt send it.

{
"a" : {"1","2"},
"b" : "hello"
}

{
"a" : null,
"b" : "hello"
}

{
"b" : "hello"
}

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using any JSON parser libraries? For example., if you use the Jackson faster JSON parser, you can serialize and de-serialize your JSON's into objects and vice-versa. While doing so, you can specify on your object mapping to ignore null, unknown fields!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!