toDatatablesJSONString

@return string
13291
public function toDatatablesJSONString() {
		$return_object_array = [ ];
		$fields = $this->getFields ();
		foreach ( $fields as $field ) {
			$value = call_user_func ( array (
					$this,
					'get' . $field 
			) );
			if ($value instanceof \DateTime) {
				$value = $value->format ( 'Y-m-d' );
			}
			array_push ( $return_object_array, array (
					$field => $value 
			) );
		}
		return json_encode ( $this );
	}
1196697
public function toJson() {
    	$result = array();
    	$result['name'] = $this->getName();
    	$result['hasDefault'] = $this->isDefaultValueAvailable();
    	try {
    		if ($result['hasDefault']) {
    			// In some cases, the call to getDefaultValue can log NOTICES
    			// in particular if an undefined constant is used as default value.
    			ob_start();
    			if ($this->isDefaultValueConstant() && !defined($this->getDefaultValueConstantName())) {
    			    throw new \Exception('Constant "'.$this->getDefaultValueConstantName().'" does not exist.');
                }
    			$result['default'] = $this->getDefaultValue();
    			$possibleError = ob_get_clean();
    			if ($possibleError) {
    				throw new \Exception($possibleError);
    			}
    		}
    		$result['isArray'] = $this->isArray();
    		
    		// Let's export only the type if we are in a constructor... in order to save time.
    		if ($this->getDeclaringFunction()->isConstructor()) {
    			// TODO: is there a need to instanciate a  MoufPropertyDescriptor?
    			$moufPropertyDescriptor = new MoufPropertyDescriptor($this);
    
    			$result['comment'] = $moufPropertyDescriptor->getDocCommentWithoutAnnotations();
    
    	    	$types = $moufPropertyDescriptor->getTypes();
	    		$result['types'] = $types->toJson();
	    	 
	    		if ($types->getWarningMessage()) {
	    			$result['classinerror'] = $types->getWarningMessage();
	    		}
    			
    			/*if ($moufPropertyDescriptor->isAssociativeArray()) {
    				$result['keytype'] = $moufPropertyDescriptor->getKeyType();
    			}
    			if ($moufPropertyDescriptor->isArray()) {
    				$result['subtype'] = $moufPropertyDescriptor->getSubType();
    			}*/
    		}
    	} catch (\Exception $e) {
    		$result['classinerror'] = $e->getMessage();
    	}
    
    	return $result;
    }
104062
public String toJsonString() {
	JSONArray jsonArray = new JSONArray();
	jsonArray.put(data);
	return jsonArray.toString();
    }
357639
public function getJson()
    {
      return json_encode(
        array(
          'name' => $this->name,
          'mime' => $this->mime,
          'height' => $this->height,
          'width' => $this->width,
          'size' => $this->_files['size'],
          'location' => $this->location,
          'fullpath' => $this->fullPath,
        )
      );
    }
530194
public function getJsonString()
    {
        if (defined('PSI_JSON_ISSUE') && (PSI_JSON_ISSUE)) {
            return json_encode(simplexml_load_string(str_replace(">", ">\n", $this->getXMLString()))); // solving json_encode issue
        } else {
            return json_encode(simplexml_load_string($this->getXMLString()));
        }
    }
1181149
@Override
    public String toJSONString()
    {
        final JSONObject object = toJSONObject();

        if (null != object)
        {
            return object.toString();
        }
        return null;
    }
1143251
public function getJavascriptClientData()
    {
        $data = [
            'routes' => [
                'prefixes' => config('tddd.routes.prefixes'),
            ],

            'project_id' => request()->get('project_id'),

            'test_id' => request()->get('test_id'),

            'root' => config('tddd.root'),
        ];

        return json_encode($data);
    }
155265
public function getJsonData() : array
    {
        $config = ['enabled' => $this->isEnabled, 'actions' => []];
        foreach ($this->actions as $action) {
            $config['actions'][] = $action->getJsonData();
        }
        return $config;
    }
686836
public function getJSONString()
	{
		$json = '{'
				. '"@context":"' .			SocialRecord::JSONLD_CONTEXT . '",'
				. '"@type":"' .				SocialRecord::JSONLD_TYPE . '",'
				. '"type":"' .				$this->type . '",'
				. '"globalID":"' .			$this->globalID . '",'
				. '"platformGID":"' .		$this->platformGID . '",'
				. '"displayName":"' .		$this->displayName . '",'
				. '"profileLocation":"' .	$this->profileLocation . '",'
				. '"personalPublicKey":"' .	PublicKey::exportKey($this->personalPublicKey) . '",'
				. '"accountPublicKey":"' .	PublicKey::exportKey($this->accountPublicKey) . '",'
				. '"salt":"' .	 			$this->salt . '",'
				. '"datetime":"' .	 		$this->datetime . '",'
				. '"active":' . 			$this->active . ','
				. '"keyRevocationList":[';
				
		foreach($this->keyRevocationList as $krc)
		{
			$json .= $krc->getJSONString();
			if($krc !== end($this->keyRevocationList)) $json .= ',';
		}
		
		$json .= ']}';
		
		return $json;
	}
981361
public function toJson()
    {
        array_walk_recursive($this->params, function (&$value) {
            $value = (string) $value;
        });
        return json_encode($this->params);
    }
353030
protected function getConfig()
    {
        if (!$this->table->getDataSource() instanceof Dom) {
            $this->prepareColumnsConfig();
        }
        $this->prepareExtensionsConfig();

        $config = [];
        $config += $this->table->getProperties();

        return json_encode($config);
    }
128317
public function getJSON()
    {
        /* convert to proper types */
        $o = new \stdClass;
        $o->command = (string) $this->command;
        $o->command_id = $this->command_id;
        $o->params = (object) $this->params;
        $o->variables = (object) $this->variables;
        /* json */
        return json_encode($o);
    }
884577
public function getJSData()
    {
        return [
            'name'          => $this->name,
            'title'         => $this->title,
            'description'   => $this->description,
            'column'        => $this->column,
            'extraColumn'   => $this->extraColumn,
            'columnFormat'  => $this->columnFormat,
            'addForm'       => $this->addForm,
            'editForm'      => $this->editForm,
            'inputType'     => $this->inputType,
            'actions'       => $this->actions,

            'deleteOption'      => $this->deleteOption,
            'editOption'        => $this->editOption,
            'addOption'         => $this->addOption,
            'orderOption'       => $this->orderOption,
            'exportOption'      => $this->exportOption,
            'microEditOption'   => $this->microEditOption,

            'modelDefaults' => $this->modelDefaults,
            'selectOptions' => $this->selectOptions,
            'filters'       => $this->filters,
            'richFilters'   => $this->richFilters,
            'showFilters'   => $this->showFilters,
            'trans'         => $this->trans,
            'moduleInPopup' => $this->moduleInPopup,
            'customActions' => $this->customActions,
            'panelView'     => $this->panelView,
            'orderParameters' => $this->orderParameters,
            'checkboxColumn' => $this->checkboxColumn,
            'defaultSortAttr' => $this->defaultSortAttr,
            'defaultSortOrder' => $this->defaultSortOrder,
            'interfaceTrans' => $this->getInterfaceTrans(),
            'thumbnailColumns' => $this->getThumbnailColumns(),
            'dateTimePickerOptions' => $this->getDateTimePickerOptions(),

            'config' => [
                'routePrefix'    => config('crude.routePrefix'),
                'numRowsOptions' => config('crude.numRowsOptions'),
                'iconClassName'  => config('crude.iconClassName'),
                'refreshAll'     => config('crude.refreshAll'),
                'mapCenter'      => config('crude.mapCenter'),
                'sortAttr'       => $this->getOrderAttribute(),
            ],
        ];
    }
1324983
public function toJson()
    {
        $json = null;
        if (!empty($this->toArray())) {
            $json = json_encode($this->toArray());
        }

        return $json;
    }
868037
public function toJson()
    {
        $data = [];

        foreach ($this->attributes as $key => $value) {
            if (!in_array($key, $this->hidden)) {
                $data[$key] = $value;
            }
        }

        return json_encode($data);
    }
325929
public function toJson ()
    {
        $rows    = array_map("str_getcsv", explode("\n", trim($this->data)));
        $columns = array_shift($rows);
        $csv     = array();

        foreach ($rows as $row)
        {
            $csv[] = array_combine($columns, $row);
        }

        return json_encode($csv);
    }
35428
@Override
    public String toJSONString() {
        JSONStringer js = new JSONStringer();
        try {

            js.object();

            // status code (1 byte)
            js.keySymbolValuePair(JSON_STATUS_KEY, getStatusCode());

            // column schema
            js.key(JSON_SCHEMA_KEY).array();
            for (int i = 0; i < getColumnCount(); i++) {
                js.object();
                js.keySymbolValuePair(JSON_NAME_KEY, getColumnName(i));
                js.keySymbolValuePair(JSON_TYPE_KEY, getColumnType(i).getValue());
                js.endObject();
            }
            js.endArray();

            // row data
            js.key(JSON_DATA_KEY).array();
            VoltTableRow row = cloneRow();
            row.resetRowPosition();
            while (row.advanceRow()) {
                js.array();
                for (int i = 0; i < getColumnCount(); i++) {
                    row.putJSONRep(i, js);
                }
                js.endArray();
            }
            js.endArray();

            js.endObject();
        }
        catch (JSONException e) {
            e.printStackTrace();
            throw new RuntimeException("Failed to serialized a table to JSON.", e);
        }
        return js.toString();
    }