Skip to content

DataUtil

TCreopargh edited this page Jan 11, 2021 · 8 revisions

Provides utilities for IData.

Importing class

import mods.ctintegration.data.DataUtil;

Methods

Method Description
static IData fromJSON(String jsonString) Converts a json String or NBT string representation to IData, returns null if errored
static IData parse(String jsonString) Does the same thing as above, just with a different name
static String toNBTString(IData data) Converts an IData to NBT string representation
String getRawString(IData data) Discard the type definitions. Output is what you get when calling String.valueof() on the basic types (string, double, etc) For lists and maps this just simply cast them to string
static String toJson(IData data) [Experimental] converts an IData to JSON. Some properties might be lost, such as type definitions

IData expansion

You can now call these methods on an IData object.

Method Desription
static String toNBTString(IData data)
static String getRawString(IData data)
static String toJson(IData data)
Clone this wiki locally