2
2
3
3
import com.fasterxml.jackson.core.JsonGenerator;
4
4
import com.github.fabienrenaud.jjb.model.Users;
5
-
import com.github.fabienrenaud.jjb.model.Users.User;
6
5
import com.github.fabienrenaud.jjb.model.Users.Friend;
6
+
import com.github.fabienrenaud.jjb.model.Users.User;
7
7
import com.google.gson.stream.JsonWriter;
8
8
import com.owlike.genson.stream.ObjectWriter;
9
9
@@ -321,4 +321,89 @@ private void jackson(final JsonGenerator j, final User u) throws IOException {
321
321
}
322
322
j.writeEndObject();
323
323
}
324
+
325
+
@Override
326
+
public org.json.simple.JSONObject jsonsimple(final Users obj) throws IOException {
327
+
org.json.simple.JSONObject jso = new org.json.simple.JSONObject();
328
+
if (obj.users != null) {
329
+
org.json.simple.JSONArray jsarr = new org.json.simple.JSONArray();
330
+
for (User u : obj.users) {
331
+
jsarr.add(jsonsimple(u));
332
+
}
333
+
jso.put("users", jsarr);
334
+
}
335
+
return jso;
336
+
}
337
+
338
+
private org.json.simple.JSONObject jsonsimple(final User u) throws IOException {
339
+
org.json.simple.JSONObject jso = new org.json.simple.JSONObject();
340
+
if (u._id != null) {
341
+
jso.put("_id", u._id);
342
+
}
343
+
jso.put("index", u.index);
344
+
if (u.guid != null) {
345
+
jso.put("guid", u.guid);
346
+
}
347
+
jso.put("isActive", u.isActive);
348
+
if (u.balance != null) {
349
+
jso.put("balance", u.balance);
350
+
}
351
+
if (u.picture != null) {
352
+
jso.put("picture", u.picture);
353
+
}
354
+
jso.put("age", u.age);
355
+
if (u.eyeColor != null) {
356
+
jso.put("eyeColor", u.eyeColor);
357
+
}
358
+
if (u.name != null) {
359
+
jso.put("name", u.name);
360
+
}
361
+
if (u.gender != null) {
362
+
jso.put("gender", u.gender);
363
+
}
364
+
if (u.company != null) {
365
+
jso.put("company", u.company);
366
+
}
367
+
if (u.email != null) {
368
+
jso.put("email", u.email);
369
+
}
370
+
if (u.phone != null) {
371
+
jso.put("phone", u.phone);
372
+
}
373
+
if (u.address != null) {
374
+
jso.put("address", u.address);
375
+
}
376
+
if (u.about != null) {
377
+
jso.put("about", u.about);
378
+
}
379
+
if (u.registered != null) {
380
+
jso.put("registered", u.registered);
381
+
}
382
+
jso.put("latitude", u.latitude);
383
+
jso.put("longitude", u.longitude);
384
+
if (u.tags != null) {
385
+
org.json.simple.JSONArray jsarr = new org.json.simple.JSONArray();
386
+
for (String t : u.tags) {
387
+
jsarr.add(t);
388
+
}
389
+
jso.put("tags", jsarr);
390
+
}
391
+
if (u.friends != null) {
392
+
org.json.simple.JSONArray jsarr = new org.json.simple.JSONArray();
393
+
for (Friend f : u.friends) {
394
+
org.json.simple.JSONObject jso0 = new org.json.simple.JSONObject();
395
+
jso0.put("id", f.id);
396
+
jso0.put("name", f.name);
397
+
jsarr.add(jso0);
398
+
}
399
+
jso.put("friends", jsarr);
400
+
}
401
+
if (u.greeting != null) {
402
+
jso.put("greeting", u.greeting);
403
+
}
404
+
if (u.favoriteFruit != null) {
405
+
jso.put("favoriteFruit", u.favoriteFruit);
406
+
}
407
+
return jso;
408
+
}
324
409
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4