Groovy web console

subscribe to the feed Subscribe
to this
site

Test wrond

Published 3 weeks ago by artem with tags groovy
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.json.JsonSlurperClassic

String xml = 
"""
<path>
    <testdata>
        <item>
            <resourceURI>https://localhost/version/</resourceURI>
            <relativePath>/test/folder/version/</relativePath>
            <text>version</text>
            <leaf>false</leaf>
            <lastModifiedtest>2021-07-03</lastModifiedtest>
            <sizeOnDisk>-1</sizeOnDisk>
        </item>
    </testdata>
</path>

"""
JSONObject json = XML.toJSONObject(xml);
String jsonPrettyPrintString = json.toString(4);
System.out.println(jsonPrettyPrintString);