Saturday, April 23, 2016

Why json format can't has the same ID value of different object?

Leave a Comment

I'm having problem when I set the same id value of different object's attribute like below : "timestampId":4,"UserId":4,"ParentId":4,

enter image description here

but when i change to different value, It works properly :

enter image description here

2 Answers

Answers 1

JSON itself can have the same value in different attributes — there is nothing wrong with it.

It is your API endpoint (http://localhost:8080/eHealthBackend/NewUserAccountParent) that does not accept the same value for certain attributes. Apparently it has some validation logic doing that, for example a user's parentId cannot be the same as userId which kind of makes sense — you cannot be parent to yourself.

Answers 2

I think @DrakeES is right,there might be some validation in Your API,as per the data, when you check the working example image which you have put here,you can see that you are sending the PARENTID:6, but you are getting PARENTID:2 as response.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment