GitHub Action to filter JSON files by provided fields and operation mode (unique/duplicate)
Processes JSON file by provided list of fields and file source parameters.
sourceData
Optional JSON data source file with action parameters:
[
{
"sourceFile": "./data/african_proverbs.json",
"targetPath": "./data",
"targetFile": "african_proverbs_unique.json",
"mode": "unique",
"jsonPath": "$.african[*]",
"jsonFields": [
"text"
]
},
{
"sourceFile": "./data/gypsy_proverbs.json",
"targetPath": "./data",
"targetFile": "gypsy_proverbs_unique.json",
"mode": "unique",
"jsonPath": "$.gypsy[*]",
"jsonFields": [
"text"
]
}
]
[
{
"sourceFile": "./data/african_proverbs.json",
"targetPath": "./data",
"mode": "unique",
"jsonPath": "$.african[*]",
"jsonFields": [
"text"
]
},
{
"sourceFile": "./data/gypsy_proverbs.json",
"targetPath": "./data",
"mode": "unique",
"jsonPath": "$.gypsy[*]",
"jsonFields": [
"text"
]
}
]
mode
Required JSON operation mode
unique
Only unique fields must be processed
duplicate
Only duplicate fields must be processed
jsonPath
Required String representing JSON query path ($.property1.property2)
More information on JSON path queries can be found at jsonpath
jsonFields
Optional String representing comma-separated list of fields to process (field1,field2,...,fieldN)
sourceFile
Required Source JSON file to process
targetPath
Required Target path to store processed JSON file
targetFile
Optional Target JSON destination file name (default sourceFile)
changed
JSON processing operation status
true
When JSON source file successfully processed and results stored to destination folder
false
When error occurred while processing JSON source file
- name: Process JSON file by fields
uses: alexrogalskiy/github-action-json-fields@master
with:
mode: 'unique'
jsonPath: 'african'
jsonFields: 'text'
sourceFile: ./data/african_proverbs.json
targetPath: ./data
targetFile: african_proverbs_unique.json
Running locally:
npm run start:action --action github-action-json-fields --mode 'unique' --jsonPath 'african' --jsonFields 'text' --sourceFile './data/african_proverbs.json' --targetPath './data' --targetFile 'african_proverbs_unique.json'
Json Fields is distributed under LGPL version 3 or later, [License]. LGPLv3 is additional permissions on top of GPLv3.
Json Fields is maintained by the following GitHub team-members:
with community support please contact with us if you have some question or proposition.
The project uses SemVer for versioning. For the versions available, see the tags on this repository.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us (emoji key).
This project follows the all-contributors specification. Contributions of any kind are welcome!
See also the list of contributors who participated in this project.
Like Json Fields ? Consider buying me a coffee :)