diff options
author | Vitaly Takmazov | 2016-07-12 17:39:33 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-07-12 17:39:33 +0300 |
commit | bdbf65e0a50758bfcc88e1cc9c501eeed4e7e45d (patch) | |
tree | 756e8b29b2442c82ae50a3548c772f4a65b6d1ef /juick-core/src/main/java/com/juick/json | |
parent | 291da35b1bf7dcd66bf621160f907872fd0f7825 (diff) |
jackson-databind WIP
Diffstat (limited to 'juick-core/src/main/java/com/juick/json')
-rw-r--r-- | juick-core/src/main/java/com/juick/json/MessageSerializer.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/juick-core/src/main/java/com/juick/json/MessageSerializer.java b/juick-core/src/main/java/com/juick/json/MessageSerializer.java index 4238df60..d5adfa6e 100644 --- a/juick-core/src/main/java/com/juick/json/MessageSerializer.java +++ b/juick-core/src/main/java/com/juick/json/MessageSerializer.java @@ -18,6 +18,7 @@ package com.juick.json; import com.juick.Message; +import com.juick.Tag; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -27,6 +28,7 @@ import java.text.SimpleDateFormat; import java.util.TimeZone; import java.util.logging.Level; import java.util.logging.Logger; +import java.util.stream.Collectors; /** * @@ -68,7 +70,7 @@ public class MessageSerializer extends JSONSerializer<Message> { if (json.has("tags")) { JSONArray tags = json.getJSONArray("tags"); for (int n = 0; n < tags.length(); n++) { - jmsg.Tags.add(tags.getString(n).replace(""", "\"")); + jmsg.Tags.add(new Tag(tags.getString(n).replace(""", "\""))); } } @@ -113,7 +115,7 @@ public class MessageSerializer extends JSONSerializer<Message> { json.put("user", userSerializer.serialize(msg.getUser())); } if (msg.Tags != null && msg.Tags.size() > 0) { - json.put("tags", new JSONArray(msg.Tags)); + json.put("tags", new JSONArray(msg.Tags.stream().map(Tag::getName).collect(Collectors.toList()))); } if (msg.Replies > 0) { json.put("replies", msg.Replies); |