|
I'm using your tool and wondering if there's a way to append content to a JSON file instead of overwriting it. |
Replies: 3 comments 1 reply
|
I'm not 100% sure what you mean but you can: Manage JSON filesBy using the - name: config
label: Config
path: config.json
format: json
type: file
fields:
- name: title
label: Website title
type: string
- name: description
label: Website description
type: string
description: Will be provused for any page with no description.
- name: url
label: Website URL
type: stringYou will be able to manage a JSON file at {
"title": "Pages CMS",
"description": "The No-Hassle CMS for Static Sites Generators",
"title": "https://pagescms.org"
}Manage JSON frontmatter filesBy using the - name: blog_json
label: Blog
type: collection
path: blog-posts
format: json-frontmatter
fields:
- name: title
label: Title
type: string
- name: author
label: Author
type: select
options:
values: [Bob Arrington, Sarah Mullen, John Smith]
- name: body
label: Body
type: rich-textYou will be able to manage a collection of JSON frontmatter files in the {
"title": "My new post",
"author": "John Smith"
}
My first blog post, all in *Markdown*!HOWEVER...As I tested this on my local, I realized there's a bug with the |
|
Can new information be added to a JSON file without overwriting the entire file? Like this: [
{
"isbn": "978-84-611-6297-7",
"owned": true,
"cover": "../assets/covers/978-84-611-6297-7.jpg",
"language": "Valencian / Valencià",
"region": "Wspólnota Walencka",
"country": "Hiszpania",
"continent": "Europa",
"translator": "Jaume Arabi",
"title": "El princep xiquet",
"year": 2007,
"author": "Antoine de Saint-Exupéry"
},
{
"isbn": "978-83-800-8533-6",
"owned": true,
"cover": "../assets/covers/978-83-800-8533-6.jpg",
"language": "Śląski",
"region": "Śląsk",
"country": "Polska",
"continent": "Europa",
"translator": "Kulik Grzegorz",
"title": "Mały Princ",
"year": 2018,
"author": "Antoine de Saint-Exupéry"
}
]I would like to have multiple pieces of information in one file and be able to add new ones, just like adding a new record to a database. |
|
Yes, here's how: content:
- name: json-list
label: JSON list
list: true
format: json
fields:
- name: isbn
type: string
- name: isbn
type: boolean
- name: language
type: string
- name: region
type: string
- name: country
type: string
- name: continent
type: string
- name: translator
type: string
- name: year
type: number
- name: author
type: stringThis will allow you to add as many entries as you want and will be saved as a JSON array. You may want to add labels to these fields, also things like |
Yes, here's how:
This will allow you to add as many entries as you want and will be saved as a JSON array.
You may want to add labels to t…