# How to get the full json of the query?

**URL:** <https://help.nextcloud.com/t/how-to-get-the-full-json-of-the-query/138235>\
**Category:** 💻 Development\
**Tags:** app-development\
**Created:** [April 28, 2022, 9:01am UTC](https://help.nextcloud.com/t/how-to-get-the-full-json-of-the-query/138235 "2022-04-28T09:01:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierreozoux](https://help.nextcloud.com/user_avatar/help.nextcloud.com/pierreozoux/32/49990_2.png) [@pierreozoux](https://help.nextcloud.com/u/pierreozoux)\
**Post date:** [April 28, 2022, 9:01am UTC](https://help.nextcloud.com/t/how-to-get-the-full-json-of-the-query/138235/1 "2022-04-28T09:01:18Z")

</div>

Hi,

I’m trying to implement the [scim protocol](http://www.simplecloud.info/) in an scim service provider app.  
When I add a user, the json I’m posting looks like this:

```auto
{
	"schemas": [
		"urn:ietf:params:scim:schemas:core:2.0:User"
	],
	"active": true,
	"id": "test2",
	"userName": "test2",
	"emails": [
		{
			"primary": true,
			"value": "tes2t@example.net"
		}
	],
	"displayname": "test2"
}

```

I used the app “provisionning\_api” as a base, and my method looks like this:

```auto
	/**
	 * @NoAdminRequired
	 * @NoCSRFRequired
	 *
	 * @param string $id
	 * @param string $displayName
     * @param array $emails
	 * @param array $groups
	 * @return DataResponse
	 * @throws OCSException
	 */
	public function addUser(string $id,
							string $displayname = '',
							array $emails = [],
							array $groups = [],
							array $subadmin = [],
							string $quota = '',
							string $preferredLanguage = ''): DataResponse {
...

```

I manage to map all params, but I struggle with the email array part.

How could I access the full json?  
Or How could I access the email value with the `'primary': true` ?

Thanks for your help!

I looked at this:

> [@POST a JSON array to a Controller](https://help.nextcloud.com/t/post-a-json-array-to-a-controller/15290):
>
> I would like to write a Controller to which a client can pass a JSON Array (e.g. using POST). Example: POST /index.php/apps/myapp/api [{id:5,data:"xyz"},{id:8,data:"xyz"}] Unfortunately, I found no way, how to access this array in the Controller, since there is no variable Name, I can use as Parameter in my Controller method. Is this possible, or would I have to embed my Array in a JSON object? e.g.: {items: [{id:5,data:"xyz"},{id:8,data:"xyz"}]} Then, I could use the variable $items as pa…

It didn’t help me 🙂

I’m trying to log to get a sense of what is the object:

```auto
		$this->logger->error('Log email: ' . array_values($emails)[0], ['app' => 'ocs_api']);

```

But I get this:

```auto
{"reqId":"tGex5C0tsPCTw7uIdVJi","level":3,"time":"2022-04-28T08:54:59+00:00","remoteAddr":"192.168.21.5","user":"admin","app":"ocs_api","method":"POST","url":"/index.php/apps/scimserviceprovider/users","message":"Log email: Array","userAgent":"insomnia/2022.2.1","version":"22.2.7.1"}

```

Is there a better way to debug? Like a remote debug? Of at least a way to print the full object in the log?

FYI, I’m using the [GitHub - juliushaertl/nextcloud-docker-dev: Nextcloud development environment using docker-compose](https://github.com/juliushaertl/nextcloud-docker-dev) as a dev env for my app dev 🙂

---

<div class="post-metadata">

**Author:** ![pierreozoux](https://help.nextcloud.com/user_avatar/help.nextcloud.com/pierreozoux/32/49990_2.png) [@pierreozoux](https://help.nextcloud.com/u/pierreozoux)\
**Post date:** [April 28, 2022, 9:17am UTC](https://help.nextcloud.com/t/how-to-get-the-full-json-of-the-query/138235/2 "2022-04-28T09:17:52Z")

</div>

Ok, I managed to make it work after some trying.

```auto
			foreach ($emails as $email) {
				$this->logger->error('Log email: ' . $email['value'], ['app' => 'ocs_api']);
				if ($email['primary'] === true) {
					$newUser->setEMailAddress($email['value']);
				}
			}

```

Basically I was expecting an object `$email->value` and not an array `$email['value']`.

But I found it, and I’m happy!

Next step for me would be to setup [a remote debugger](https://docs.nextcloud.com/server/latest/developer_manual/digging_deeper/debugging.html), this would have saved me some time I guess 🙂
