Get Filters as JSON

@return string
422794
public function getFiltersJson()
    {
        $result = [];

        if (false === is_array($this->getFilters())) {
            return "{}";
        }

        foreach ($this->getFilters() as $filterIndex => $items) {
            foreach ($items as $item) {
                $result[$filterIndex][] = [
                    'id'   => $item->getId(),
                    'text' => $item->getText(),
                ];
            }
        }

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

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

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

        if (! empty($this->registrationIds)) {
            $json['registration_ids'] = $this->registrationIds;
        }

        if ($this->collapseKey) {
            $json['collapse_key'] = $this->collapseKey;
        }

        if (! empty($this->data)) {
            $json['data'] = $this->data;
        }

        if (! empty($this->notification)) {
            $json['notification'] = $this->notification;
        }

        if ($this->delayWhileIdle) {
            $json['delay_while_idle'] = $this->delayWhileIdle;
        }

        if ($this->timeToLive != 2419200) {
            $json['time_to_live'] = $this->timeToLive;
        }

        if ($this->restrictedPackageName) {
            $json['restricted_package_name'] = $this->restrictedPackageName;
        }

        if ($this->dryRun) {
            $json['dry_run'] = $this->dryRun;
        }

        return Json::encode($json);
    }
1322141
public function filter()
    {
        return (object) [
            'type' => $this->_indexType,
            'filters' => $this->_comparisons,
            'order' => $this->_orderBy,
            'reverse' => $this->_reverse,
            'offset' => $this->_offset,
            'length' => $this->_length
        ];
    }
1206272
public function getFilters()
    {
        // @todo build commong database filters for node datasource into some
        //   trait or abstract implemetnation to avoid duplicates
        return [
            (new Filter('status', $this->t("Published")))
                ->setChoicesMap([
                    1 => $this->t("Yes"),
                    0 => $this->t("No"),
                ]),
            (new Filter('promote', $this->t("Promoted to front page")))
                ->setChoicesMap([
                    1 => $this->t("Yes"),
                    0 => $this->t("No"),
                ]),
            (new Filter('sticky', $this->t("Sticky")))
                ->setChoicesMap([
                    1 => $this->t("Yes"),
                    0 => $this->t("No"),
                ]),
            (new Filter('type', $this->t("Type")))
                ->setChoicesMap(node_type_get_names()),
            (new Filter('history_user_id', $this->t("User (history)"))),
                /* ->setChoicesMap(node_type_get_names()), @todo use callback */
            (new Filter('revision_user_id', $this->t("User (node revision)"))),
                /* ->setChoicesMap(node_type_get_names()), @todo use callback */
            (new Filter('user_id', $this->t("User (node owner)"))),
                /* ->setChoicesMap(node_type_get_names()), @todo use callback */
        ];
    }
841031
public function getFilters()
    {
        $input = $this->collection->make(
            $this->request->except($this->sortName));

        $filters = $this->collection->make();

        $input->filter(function ($value) {
            if ($this->ignoreEmptyFilters && is_string($value) &&
                (string) $value == ''
            ) {
                return false;
            }

            return true;
        })->each(function ($value, $field) use ($filters) {
            $filter = new Filter();
            $filter->setField($field);
            $filter->setValue($value);
            $filters->push($filter);
        });

        return $filters;
    }
172710
protected function getFilterArray()
    {
        return array_merge(parent::getFilterArray(), [
      self::PROPERTY_FILTER_ROLE => $this->arguments[self::ARGUMENT_FILTER_ROLE]
    ]);
    }
978213
public function toJSON()
  {
    $json = json_encode( $this->toArray() );

    return str_replace(
      [
          '"%hoverCallback%"',
          '"%formatter%"',
          '"%dateFormat%"',
      ],
      [
          $this->hoverCallback,
          $this->formatter,
          $this->dateFormat,
      ],
      $json
    );
  }
1206089
public static function getJson()
    {
        if (!static::$json) {
            $root = Ioc::getConfig()->get('path.root');
            $file = realpath($root . '/composer.json');

            static::$json = new Structure(is_file($file) ? file_get_contents($file) : null);
        }

        return static::$json;
    }
325937
public function getFilter()
    {
        if (null == $this->filter) {
            $this->filter = new Filter([
                'serviceLocator' => $this->getServiceLocator(),
                'id'             => $this->getId(),
            ]);
        }

        return $this->filter;
    }
1330794
public function wantsJson()
    {
        $acceptable = $this->getAcceptableContentTypes();
        return (isset($acceptable[0]) && (strpos($acceptable[0], '/json') !== false || strpos($acceptable[0], '+json') !== false));
    }
552422
protected function _getFilterData()
    {
        $rawFilterData = $this->request->getData();
        $filterData = [];
        foreach ($this->filterFields as $filterField => $options) {
            if (isset($rawFilterData[$filterField]) && $rawFilterData[$filterField] !== '') {
                $filterData[$filterField] = $rawFilterData[$filterField];
            }
        }

        return $filterData;
    }
1145881
public function getJsonItemSchemas()
	{
		$list = [];

		foreach( $this->getControllers() as $name => $controller ) {
			$list[$name] = $controller->getItemSchema();
		}

		if( ( $json = json_encode( $list ) ) === null ) {
			throw new \RuntimeException( 'Unable to encode schemas to JSON' );
		}

		return $json;
	}
512668
public function jsonSerialize()
		{
			$data               = (object) [];
			$data->type         = 'folder';
			$data->name         = $this->name;
			$data->route        = $this->route;
			$data->parents      = $this->parents;
			$data->folders      = $this->folders;
			$data->controllers  = $this->controllers;
			return $data;
		}
1116093
public function toJSON()
    {
        $mapper = static::getMapper();
        $json = [];

        foreach ($this->toArray() as $key => $value) {
            $attribute = $mapper->getAttribute($key);
            $json[$key] = Type::factory($attribute['type'])->toJSON($value, $attribute);
        }

        return $json;
    }
818556
public function getAllFilters()
    {
        $filters = [];

        foreach ($this->filters as $filter) {
            $filters = array_merge($filters, $filter->getAllFilters());
        }

        return $filters;
    }
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);
    }