# Yatta! API

# Class: JsonType

Defined in: | lib/Types/JsonTypes.coffee
Inherits: | types.MapManager

## Overview

Manages Object-like values.

## Variables Summary

type =

      "JsonType"

  Identifies this class. Use it to check whether this is a json-type or something else.

  ### Examples:

  ####

      var x = yatta.val('unknown')
      if (x.type === "JsonType") {
        console.log JSON.stringify(x.toJson())
      }

mutable_default =

      true

  Whether the default is 'mutable' (true) or 'immutable' (false)

## Instance Method Summary

- # (void) applyDelete()
- # (void) cleanup()
- # (Json) toJson() Transform this to a Json.
- # (void) setReplaceManager(replace_manager) Sets the parent of this JsonType object.
- # (JsonType) getParent() Get the parent of this JsonType.
- # (void) setMutableDefault(mutable) Set if the default is 'mutable' or 'immutable'
- ~ (Json) val()
- # (void) _encode() Private

## Constructor Details

# (void) constructor(uid, initial_value, mutable)

### Parameters:

- uid ( `Object` ) — A unique identifier. If uid is undefined, a new uid will be created.
- initial_value ( `Object` ) — Create this operation with an initial value.
- Whether ( `String|Boolean` ) — the initial_value should be created as mutable. (Optional - see setMutableDefault)

## Instance Method Details

# (void) applyDelete()

# (void) cleanup()

# (Json) toJson()

Transform this to a Json. If your browser supports Object.observe it will be transformed automatically when a change arrives. Otherwise you will loose all the sharing-abilities (the new object will be a deep clone)!

### Returns:

- `Json`

# (void) setReplaceManager(replace_manager)

Sets the parent of this JsonType object.

### See also:

- WordType.setReplaceManager

# (JsonType) getParent()

Get the parent of this JsonType.

### Returns:

- `JsonType`

# (void) setMutableDefault(mutable)

Set if the default is 'mutable' or 'immutable'

### Parameters:

- mutable ( `String|Boolean` ) — Set either 'mutable' / true or 'immutable' / false

~ (Json) val()
~ (JsonType|WordType|String|Object) val(name)
~ (JsonType) val(name, content)

### Overloads:

~ (Json) val()

Get this as a Json object.

### Returns:

- `Json`

~ (JsonType|WordType|String|Object) val(name)

Get value of a property.

### Parameters:

- name ( `String` ) — Name of the object property.

### Returns:

- ( `JsonType|WordType|String|Object` ) — Depending on the value of the property. If mutable it will return a Operation-type object, if immutable it will return String/Object.

~ (JsonType) val(name, content)

Set a new property.

### Parameters:

- name ( `String` ) — Name of the object property.
- content ( `Object|String` ) — Content of the object property.

### Returns:

- ( `JsonType` ) — This object. (supports chaining)

# (void) _encode() Private

Quickly fuzzy find classes, mixins, methods, file:

- T Open fuzzy finder dialog

Control the navigation frame:

- L Toggle list view
- C Show class list
- I Show mixin list
- F Show file list
- M Show method list
- E Show extras list

You can focus and blur the search input:

- S Focus search input
- Esc Blur search input