Package: org.apache.groovy.groovysh.jline

## [Groovy] Class Utils

- org.apache.groovy.groovysh.jline.Utils

-     class Utils
      extends Object

  Shared conversion helpers for rendering, parsing, and persisting shell values.

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `static void` | `persist(Path file, Object object, Format format)` Writes an object to disk using the requested persistence format.
    `` | `static String` | `toJson(Object object)` Serializes an object to JSON, pretty-printing structured values when useful.
    `` | `static Map<String, Object>` | `toMap(Object object)` Converts an object into a map representation suited for shell persistence.
    `` | `static Object` | `toObject(String json)` Parses JSON text into the corresponding Groovy object graph.
    `` | `static String` | `toString(Object object)` Renders a shell value as a human-readable string.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### static void persist(Path file, Object object, Format format)

      Writes an object to disk using the requested persistence format.

      Parameters:
        `file` - destination file
        `object` - value to persist
        `format` - output format to use

    - #### static String toJson(Object object)

      Serializes an object to JSON, pretty-printing structured values when useful.

      Parameters:
        `object` - value to serialize
      Returns:
        JSON or plain string representation

    - #### static Map<String, Object> toMap(Object object)

      Converts an object into a map representation suited for shell persistence.

      Parameters:
        `object` - value to convert
      Returns:
        map view of the object

    - #### static Object toObject(String json)

      Parses JSON text into the corresponding Groovy object graph.

      Parameters:
        `json` - JSON content to parse
      Returns:
        parsed object graph

    - #### static String toString(Object object)

      Renders a shell value as a human-readable string.

      Parameters:
        `object` - value to render
      Returns:
        string representation suitable for shell output