Facets in JSON API

Hello all,

I want to use facets in json api. Unfortunately I cannot figure out correct request.
My json query: http://localhost:8080/json?q=((PHP OR JAVA) AND (developer OR entwickler) filetype:html sort:score.desc)&num=100

I want ideally PHP and JAVA as the facets. (The facets will be decided at the query time/runtime)
This is sample expected API.
http://localhost:8080/json?q=((PHP OR JAVA) AND (developer OR entwickler) filetype:html sort:score.desc)&num=100&facets=[PHP,JAVA]

What is correct configuration of the query?
These query params are confusing for me.
fields.label, facet.field, facet.query, facet.size are confusing for me.

An example or more documentation will be apreciated.
Thanks in advance.

You can use facet.query as below:

curl -s "https://search.n2sm.co.jp/json/?num=10&sort=&q=java+OR+php&facet.query=java&facet.query=php"