Last active
August 29, 2015 14:05
-
-
Save menski/3f2a3eb75a6d843075a5 to your computer and use it in GitHub Desktop.
camunda Spin JSON support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// read JSON from String | |
SpinJsonNode json = JSON("{\"name\": \"camunda\", \"version\": \"7.2.0-alpha3\"}"); | |
// read JSON object property as String | |
String version = json.prop("version").stringValue(); | |
// calculate new version | |
int newVersion = Integer.valueOf(version.substring(version.length() - 1)) + 1; | |
version = version.substring(0, version.length() - 1 ) + newVersion; | |
// set JSON object property | |
json.prop("version", version); | |
// return JSON as String | |
System.out.println(json.toString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment