Skip to content

Commit

Permalink
Merge pull request #832 from scireum/feature/aha/json-amount-fix
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Uses proper machine formats when outputting JSON.
  • Loading branch information
andyHa authored Apr 26, 2021
2 parents 97c2a92 + 7bc458a commit 078e7d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<description>Provides a modern and scalable web server as SIRIUS module</description>

<properties>
<sirius.kernel>dev-21.1</sirius.kernel>
<sirius.kernel>dev-22.0.1</sirius.kernel>
</properties>

<repositories>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/sirius/web/services/JSONStructuredOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import sirius.kernel.commons.Amount;
import sirius.kernel.commons.Strings;
import sirius.kernel.health.Exceptions;
import sirius.kernel.health.HandledException;
import sirius.kernel.nls.NLS;
import sirius.kernel.xml.AbstractStructuredOutput;
import sirius.kernel.xml.Attribute;
import sirius.kernel.xml.StructuredOutput;
Expand Down Expand Up @@ -241,8 +243,10 @@ private void writePlainProperty(String name, Object data) {
writer.write("null");
} else if (data instanceof Boolean || data instanceof Number) {
writer.write(data.toString());
} else if (data instanceof Amount) {
writer.write(((Amount)data).toMachineString());
} else {
writeString(data.toString());
writeString(transformToStringRepresentation(data));
}
} catch (ClosedChannelException e) {
throw handleClosedChannel(e);
Expand Down

0 comments on commit 078e7d3

Please sign in to comment.