*******************************************************
Json                                                  *
*******************************************************
491001
function decodeJson(basePath, value) {
    var data = {},
        path = basePath,       // [TODO] bn is optional, so we need basePath to check type
        pathType = cutils.getPathDateType(path),
        oid = cutils.getPathIdKey(path).oid,
        rid;

    if (_.isBuffer(value) || _.isString(value))
        value = JSON.parse(value);

    if (!_.isPlainObject(value) || !value.e) 
        throw new TypeError('value should be an object.');

    switch (pathType) {
        case 'object':         // obj
            _.forEach(value.e, function (resrc) {
                var pathArray = cutils.getPathArray(resrc.n),          // [iid, rid[, riid]]
                    val;

                if (!_.isUndefined(resrc.v)) {
                    val = resrc.v;
                } else if (!_.isUndefined(resrc.sv)) {
                    val = resrc.sv;
                } else if (!_.isUndefined(resrc.bv)) {
                    val = resrc.bv;
                } else if (!_.isUndefined(resrc.ov)) {
                    val = resrc.ov;     // [TODO] objlnk
                }

                if (pathArray[0] === '')
                    pathArray = pathArray.slice(1);

                if (pathArray[pathArray.length - 1] === '')
                    pathArray = pathArray.slice(0, pathArray.length - 1);

                if (pathArray[0] && !_.has(data, pathArray[0]))
                    data[pathArray[0]] = {};

                rid = cutils.ridKey(oid, pathArray[1]);

                if (rid && !_.has(data, [pathArray[0], rid])) {
                    if (pathArray[2]) {
                        data[pathArray[0]][rid] = {};
                        data[pathArray[0]][rid][pathArray[2]] = val;
                    } else {
                        data[pathArray[0]][rid] = val;
                    }
                }
            });
            break;

        case 'instance':         // inst
            _.forEach(value.e, function (resrc) {
                var pathArray = cutils.getPathArray(resrc.n),          // [rid[, riid]]
                    val;

                if (!_.isUndefined(resrc.v)) {
                    val = resrc.v;
                } else if (!_.isUndefined(resrc.sv)) {
                    val = resrc.sv;
                } else if (!_.isUndefined(resrc.bv)) {
                    val = resrc.bv;
                } else if (!_.isUndefined(resrc.ov)) {
                    val = resrc.ov;     // [TODO] objlnk
                }

                if (pathArray[0] === '')
                    pathArray = pathArray.slice(1);

                if (pathArray[pathArray.length - 1] === '')
                    pathArray = pathArray.slice(0, pathArray.length - 1);

                rid = cutils.ridKey(oid, pathArray[0]);

                if (rid && !_.has(data, rid)) {
                    if (pathArray[1]) {
                        data[rid] = {};
                        data[rid][pathArray[1]] = val;
                    } else {
                        data[rid] = val;
                    }
                }
            });
            break;

        case 'resource':         // resrc
            _.forEach(value.e, function (resrc) {
                var riid = resrc.n,          // [[riid]]
                    isMultiResrc = false,
                    val;

                if (riid)
                    isMultiResrc = true;

                if (!_.isUndefined(resrc.v)) {
                    val = resrc.v;
                } else if (!_.isUndefined(resrc.sv)) {
                    val = resrc.sv;
                } else if (!_.isUndefined(resrc.bv)) {
                    val = resrc.bv;
                } else if (!_.isUndefined(resrc.ov)) {
                    val = resrc.ov;     // [TODO] objlnk
                }

                if (!isMultiResrc) {
                    data = val;
                } else if (isMultiResrc && !_.has(data, riid)) {
                    data[riid] = val;
                }
            });
            break;

        default:
            break;
     }
    
    return data;
}
114802
def json(self):
        
        return json.dumps(self.dict_rules,
                          sort_keys=True,
                          indent=2,
                          separators=(',', ': '))
1241829
def to_json(self):
        """"""
        return {'year': self.year,
                'month': self.month,
                'day': self.day,
                'hour': self.hour,
                'minute': self.minute}
553871
public function getJson()
    {
        $response = [
            'status' => $this->status,
        ];

        switch ($this->status) {
            case self::STATUS_SUCCESS:
            case self::STATUS_FAIL:
                $response = array_merge(
                    $response,
                    [
                        'data' => $this->data,
                    ]
                );
                break;
            case self::STATUS_ERROR;
                $code     = $this->code ? ['code' => $this->code] : [];
                $data     = $this->data ? ['data' => $this->data] : [];
                $response = array_merge(
                    $response,
                    [
                        'message' => $this->message,
                    ],
                    $code,
                    $data
                );
                break;
            default:
                // because of the check in setStatus, this should never occur
                $response = [
                    'status'  => self::STATUS_ERROR,
                    'code'    => 500,
                    'message' => 'JSend response was built illegally',
                    'data'    => [
                        'original-data' => [
                            'status'  => $this->status,
                            'code'    => $this->code,
                            'message' => $this->message,
                            'data'    => $this->data,
                        ],
                    ],
                ];
                break;
        }

        return json_encode($response);
    }
879149
def json(self):
        '''  '''
        ctype = self.environ.get('CONTENT_TYPE', '').lower().split(';')[0]
        if ctype == 'application/json':
            b = self._get_body_string()
            if not b:
                return None
            return json_loads(b)
        return None
213273
def json(self):
        """"""

        if not self.headers and len(self.content) > 3:
            encoding = get_encoding_from_headers(self.headers)
            if encoding is not None:
                return json.loads(self.content.decode(encoding))
        return json.loads(self.content)
78848
public void json(String json) {
    if (LogLevel.DEBUG < logConfiguration.logLevel) {
      return;
    }
    printlnInternal(LogLevel.DEBUG, logConfiguration.jsonFormatter.format(json));
  }
767746
def json(self):
        
        try:
            return self._json
        except AttributeError:
            try:
                self._json = json.loads(self.text)
                return self._json
            except:  # noqa e722
                raise RequestInvalidJSON("Invalid JSON received")
635809
public function toJSON()
	{
		$json = json_encode( $this->toArray() );
		if ( json_last_error() == JSON_ERROR_NONE )
			return $json;

			XBRL_Log::getInstance()->err( "Failed to generate JSON for types" );

			return false;
	}
548419
public JSONObject toJSON() throws JSONException {
        JSONObject json = new JSONObject();

        json.put(JSON_TYPE, this.getType());

        return json;
    }
56117
Object asJSON() {
        final Map<String, Object> json = new HashMap<>();
        json.put("JOIN", type.getTag());
        json.putAll(dataSource.asJSON());
        return json;
    }
447270
function json(url, callback) {
    return request(url, function(req) {
      if (req.responseText) callback(JSON.parse(req.responseText));
    }, "application/json");
  }
62379
private function createJson() {
    $content = $this->getContent()->get();
    $json = json_encode(
      $content,
      JSON_PRESERVE_ZERO_FRACTION |
      JSON_BIGINT_AS_STRING |
      JSON_NUMERIC_CHECK |
      JSON_PRETTY_PRINT |
      JSON_UNESCAPED_SLASHES
    );

    if (!$this->isValidJson($json)) {
      throw new \Nuki\Exceptions\Base('Encoded json string is not valid, check input');
    }
    
    return $json;
  }
1092717
def json_data(self):
        """"""
        return {
            "number": self.number,
            "type": self.type,
            "participant_id": self.participant_id,
            "question": self.question,
            "response": self.response,
        }
1160410
protected function _getJson()
    {
        if ($this->_json) {
            return $this->_json;
        }

        return $this->_json = json_decode($this->_getBody(), true);
    }
298431
private JSON getJSON() throws JSONMarshallException {
        if (json == null) {
            JSONSettings settings = new JSONSettings(Include.NON_NULL);
            json = JSONFactory.newInstance(settings);
        }
        return json;
    }
57763
function toJSON() {
    var s = this;
    var values = Object.assign({}, s.schema);
    Object.keys(values).forEach(function (key) {
      var isFunc = iftype.isFunction(values[key]);

      if (isFunc) {
        delete values[key];
      }
    });
    return values;
  }