﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35718	Add JSONArray Func	john-parton	john-parton	"This ticket was originally opened with the intent for me to provide implementations for a bunch of postgres functions, but it became clear from discussion that the most important bit was to implement a non-postgres-specific JSONArray function.

Original post:

There's a large number of postgres-specific functions for manipulating json: https://www.postgresql.org/docs/current/functions-json.html

In my projects for work, I have created several:

* ~~jsonb_build_object~~ -- Actually already implemented as `django.db.models.functions.JSONObject`
* jsonb_build_array
* jsonb_array_elements
* ~~jsonb_extract_path~~ Functionally equivalent to the `#>` operator
* ~~jsonb_extract_path_text~~ Functionally equivalent to the `#>>` operator
* jsonb_array_length

There also a few operators that I implemented as django functions

* jsonb || jsonb -> jsonb - Concatenates two jsonb values
* jsonb - text -> jsonb - Deletes a key (and its value) from a JSON object

It would be nice if these were included in `contrib.postgres.functions`, ideally in a submodule like `contrib.postgres.function.json` to allow room to expand.

I know postgres's json support is a bit of test-bed for more fleshed out json support in general, but I would recommend just adding things as postgres-specific to limit the scope of the changes.

I can open a basic pull request."	New feature	closed	Database layer (models, ORM)	dev	Normal	fixed		Sage Abdullah	Ready for checkin	1	0	0	0	0	0
