# Class: JsonWrapper

Defined in: | lib/Types/JsonTypes.coffee

## Overview

Note: You can only overwrite existing values! Setting a new property won't have any effect!

A JsonWrapper was intended to be a convenient wrapper for the JsonType. But it can make things more difficult than they are.

It creates Javascripts -getter and -setter methods for each property that JsonType maintains.

In order to set a new property you have to overwrite an existing property. Therefore the JsonWrapper supports a special feature that should make things more convenient (we can argue about that, use the JsonType if you don't like it ;). If you overwrite an object property of the JsonWrapper with a new object, it will result in a merged version of the objects. Let w.p the property that is to be overwritten and o the new value. E.g. w.p = o

- The result has all properties of o
- The result has all properties of w.p if they don't occur under the same property-name in o.

### Examples:

#### create a JsonWrapper

    # You get a JsonWrapper from a JsonType by calling
    w = yatta.value

#### Getter Example

    # you can access the x property of yatta by calling
    w.x
    # instead of
    yatta.val('x')

#### Setter Example

    # you can set an existing x property of yatta by calling
    w.x = "text"
    # instead of
    yatta.val('x', "text")

#### Conflict Example

    yatta.value = {a : "string"}
    w = yatta.value
    console.log(w) # {a : "string"}
    w.a = {a : {b : "string"}}
    console.log(w) # {a : {b : "String"}}
    w.a = {a : {c : 4}}
    console.log(w) # {a : {b : "String", c : 4}}

#### Common Pitfalls

    w = yatta.value
    # Setting a new property
    w.newProperty = "Awesome"
    console.log(w.newProperty == "Awesome") # false, w.newProperty is undefined
    # overwrite the w object
    w = {newProperty : "Awesome"}
    console.log(w.newProperty == "Awesome") # true!, but ..
    console.log(yatta.value.newProperty == "Awesome") # false, you are only allowed to set properties!
    # The solution
    yatta.value = {newProperty : "Awesome"}
    console.log(w.newProperty == "Awesome") # true!

### See also:

- JsonType
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty

## Constructor Details

# (void) constructor(jsonType)

### Parameters:

- jsonType ( `JsonType` ) — Instance of the JsonType that this class wrappes.

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