Class JSONInstances

java.lang.Object
weka.core.json.JSONInstances

public class JSONInstances extends Object
Class for transforming Instances objects into JSON objects and vice versa. Missing values get stored as "?".
Version:
$Revision: 9664 $
Author:
FracPete (fracpete at waikato dot ac dot nz)
See Also:
  • Field Details

  • Constructor Details

    • JSONInstances

      public JSONInstances()
  • Method Details

    • toInstances

      public static Instances toInstances(JSONNode json)
      Turns a JSON object, if possible, into an Instances object.
      Parameters:
      json - the JSON object to convert
      Returns:
      the generated Instances object, null if not possible
    • toHeader

      public static Instances toHeader(JSONNode json)
      Turns a JSON object, if possible, into an Instances object (only header).
      Parameters:
      json - the JSON object to convert
      Returns:
      the generated Instances header object, null if not possible
    • toJSON

      public static JSONNode toJSON(Instances inst)
      Turns the Instances object into a JSON object.
      Parameters:
      inst - the Instances to turn into a JSON object
      Returns:
      the JSON object
    • main

      public static void main(String[] args) throws Exception
      For testing only.
      Parameters:
      args - expects a dataset as first parameter
      Throws:
      Exception - if something goes wrong