Permalink
Browse files

- Fixed missing JSON media type with converter service and the

         JSON extension.
  • Loading branch information...
1 parent 94731cf commit de7a7b07de0cfd5fe3d21f8b51d8ede473f1d194 @jlouvel jlouvel committed Apr 26, 2012
View
2 build/tmpl/text/changes.txt
@@ -12,6 +12,8 @@ Changes log
Reported by Gabriel Pulido.
- Usage of ranges on representations having unknown size.
Reported by Bjorn Roche.
+ - Fixed missing JSON media type with converter service and the
+ JSON extension.
- 2.0.13 (2012-04-18)
- Bug fixed
View
7 modules/org.restlet.ext.json/src/org/restlet/ext/json/JsonConverter.java
@@ -45,7 +45,6 @@
import org.restlet.engine.converter.ConverterHelper;
import org.restlet.engine.resource.VariantInfo;
import org.restlet.representation.Representation;
-import org.restlet.representation.StringRepresentation;
import org.restlet.representation.Variant;
import org.restlet.resource.UniformResource;
@@ -180,11 +179,11 @@ public Representation toRepresentation(Object source, Variant target,
Representation result = null;
if (source instanceof JSONArray) {
- result = new StringRepresentation(((JSONArray) source).toString());
+ result = new JsonRepresentation((JSONArray) source);
} else if (source instanceof JSONObject) {
- result = new StringRepresentation(((JSONObject) source).toString());
+ result = new JsonRepresentation((JSONObject) source);
} else if (source instanceof JSONTokener) {
- result = new StringRepresentation(((JSONTokener) source).toString());
+ result = new JsonRepresentation((JSONTokener) source);
}
return result;

0 comments on commit de7a7b0

Please sign in to comment.