11 JSONObject jsonObject = (JSONObject)
new JSONParser().parse(json);
13 if (!jsonObject.containsKey(
"id")) {
14 throw new ValidateJSONObjectException(
"id missing");
16 if (!jsonObject.containsKey(
"firstName")) {
17 throw new ValidateJSONObjectException(
"firstName missing");
19 if (!jsonObject.containsKey(
"lastName")) {
20 throw new ValidateJSONObjectException(
"lastName missing");
22 if (!jsonObject.containsKey(
"orcid")) {
23 throw new ValidateJSONObjectException(
"orcid missing");
25 if (!jsonObject.containsKey(
"affiliation")) {
26 throw new ValidateJSONObjectException(
"affiliation missing");
30 if (jsonObject.containsKey(
"id")) {
31 jsonObject.remove(
"id");
33 if (jsonObject.containsKey(
"firstName")) {
34 jsonObject.remove(
"firstName");
36 if (jsonObject.containsKey(
"lastName")) {
37 jsonObject.remove(
"lastName");
39 if (jsonObject.containsKey(
"orcid")) {
40 jsonObject.remove(
"orcid");
42 if (jsonObject.containsKey(
"affiliation")) {
43 jsonObject.remove(
"affiliation");
46 if (jsonObject.containsKey(
"title")) {
47 jsonObject.remove(
"title");
49 if (jsonObject.containsKey(
"pwd")) {
50 jsonObject.remove(
"pwd");
52 if (jsonObject.containsKey(
"status")) {
53 jsonObject.remove(
"status");
55 if (jsonObject.containsKey(
"role")) {
56 jsonObject.remove(
"role");
58 if (!jsonObject.isEmpty()) {
59 throw new ValidateJSONObjectException(
"found unsupported key");