项目作者: json-next

项目描述 :
JSON v1.1 Feed - JSON Feed Evolved for Humans thanks to JSON: 1.1 # JSON with Extensions (JSONX) - Easy-to-Write, Easy-to-Read
高级语言:
项目地址: git://github.com/json-next/json-feed.git
创建时间: 2017-07-11T11:34:41Z
项目社区:https://github.com/json-next/json-feed

开源协议:Creative Commons Zero v1.0 Universal

下载


Comments • Unquoted keys • Multi-line strings • Trailing commas • Optional commas • Auto-wrapped feed object • Simple feed version string • <..-..> shortcuts • Optional = is the new : • and more

JSON v1.1 Feed

JSON Feed Evolved for Humans - Easy-to-Write, Easy-to-Read

Welcome

What’s a Feed in JSON with Extensions (JSONX) in JSON v1.1? Why? Why?

JSON Feed is a feed format similar to RSS and Atom in JSON. See jsonfeed.org ». Example:

  1. {
  2. "version": "https://jsonfeed.org/version/1",
  3. "title": "My Example Feed",
  4. "home_page_url": "https://example.org/",
  5. "feed_url": "https://example.org/feed.json",
  6. "items": [
  7. {
  8. "id": "2",
  9. "content_text": "This is a second item.",
  10. "url": "https://example.org/second-item"
  11. },
  12. {
  13. "id": "1",
  14. "content_html": "<p>Hello, world!</p>",
  15. "url": "https://example.org/initial-post"
  16. }
  17. ]
  18. }

Now thanks to JSON: 1.1 # JSON with Extensions (JSONX) let’s
make JSON Feed easier-to-write and easier-to-read.
How about?

“Classic” Colon (:) Variant

Note: You can use unquoted keys and all commas are optional.

  1. # JSON Feed shortened w/ JSON v1.1, JSON with Extensions (JSONX)
  2. version : '1'
  3. title : 'My Example Feed'
  4. home_page_url : 'https://example.org/'
  5. feed_url : 'https://example.org/feed.json'
  6. items : [
  7. {
  8. id : '2'
  9. content_text : 'This is a second item.'
  10. url : 'https://example.org/second-item'
  11. } {
  12. id : '1'
  13. content_html : '<p>Hello, world!</p>'
  14. url : 'https://example.org/initial-post'
  15. }]

“Classic” Colon (:) Variant with (<..-..>) Shortcuts

Note: You can shortcut [{..},{..}] with <..-..>.

  1. # JSON Feed shortened w/ JSON v1.1, JSON with Extensions (JSONX)
  2. version : '1'
  3. title : 'My Example Feed'
  4. home_page_url : 'https://example.org/'
  5. feed_url : 'https://example.org/feed.json'
  6. items :
  7. < id : '2'
  8. content_text : 'This is a second item.'
  9. url : 'https://example.org/second-item'
  10. -
  11. id : '1'
  12. content_html : '<p>Hello, world!</p>'
  13. url : 'https://example.org/initial-post'
  14. >

“Alternate” Equals (=) Variant

Note: Using = as key/value separator lets you use unquoted urls or datetimes - because the colon (:) is no longer special.

  1. # JSON Feed shortened w/ JSON v1.1, JSON with Extensions (JSONX)
  2. version = '1'
  3. title = 'My Example Feed'
  4. home_page_url = https://example.org/
  5. feed_url = https://example.org/feed.json
  6. items =
  7. < id = '2'
  8. content_text = 'This is a second item.'
  9. url = https://example.org/second-item
  10. -
  11. id = '1'
  12. content_html = '<p>Hello, world!</p>'
  13. url = https://example.org/initial-post
  14. >

Spec

Feed Format Specification in English

JSON v1.1 Feed follows JSON Feed but allows all JSON v1.1 extensions e.g.:

  • quotes for strings are optional if they follow JavaScript identifier rules (with some additions e.g. .-+/^@)
  • single line comments start with # or //
  • commas after object key-value pairs are optional
  • commas after array items are optional
  • <..>shortcut for [{..}]
  • - shortcut for },{
  • and much more

Plus some extras for JSON Feed:

  • feed gets auto-wrapped in object, that is, { ... }
  • version number gets shortend to 1 instead of https://jsonfeed.org/version/1

Examples

Podcast

“Classic” Colon (:) Variant with (<..-..>) Shortcuts

  1. version : '1'
  2. user_comment : 'This is a podcast feed. You can add this feed to your podcast client using the following URL: http://therecord.co/feed.json'
  3. title : 'The Record'
  4. home_page_url : 'http://therecord.co/'
  5. feed_url : 'http://therecord.co/feed.json'
  6. items :
  7. < id : 'http://therecord.co/chris-parrish'
  8. title : 'Special #1 - Chris Parrish'
  9. url : 'http://therecord.co/chris-parrish'
  10. content_text : `Chris has worked at Adobe and as a founder of Rogue Sheep,
  11. which won an Apple Design Award for Postage. Chris's new company is Aged & Distilled
  12. with Guy English - which shipped Napkin, a Mac app for visual collaboration.
  13. Chris is also the co-host of The Record. He lives on Bainbridge Island,
  14. a quick ferry ride from Seattle.`
  15. content_html : `Chris has worked at <a href="http://adobe.com/">Adobe</a> and as a founder of Rogue Sheep,
  16. which won an Apple Design Award for Postage. Chris's new company is Aged & Distilled
  17. with Guy English - which shipped <a href="http://aged-and-distilled.com/napkin/">Napkin</a>,
  18. a Mac app for visual collaboration. Chris is also the co-host of The Record.
  19. He lives on <a href="http://www.ci.bainbridge-isl.wa.us/">Bainbridge Island</a>,
  20. a quick ferry ride from Seattle.`
  21. summary : 'Brent interviews Chris Parrish, co-host of The Record and one-half of Aged & Distilled.'
  22. date_published : '2014-05-09T14:04:00-07:00'
  23. attachments :
  24. < url : 'http://therecord.co/downloads/The-Record-sp1e1-ChrisParrish.m4a'
  25. mime_type : audio/x-m4a
  26. size_in_bytes : 89_970_236
  27. duration_in_seconds : 6_629
  28. >
  29. >

“Alternate” Equals (=) Variant

  1. version = '1'
  2. user_comment = 'This is a podcast feed. You can add this feed to your podcast client using the following URL: http://therecord.co/feed.json'
  3. title = 'The Record'
  4. home_page_url = http://therecord.co/
  5. feed_url = http://therecord.co/feed.json
  6. items =
  7. < id = http://therecord.co/chris-parrish
  8. title = 'Special #1 - Chris Parrish'
  9. url = http://therecord.co/chris-parrish
  10. content_text = `Chris has worked at Adobe and as a founder of Rogue Sheep,
  11. which won an Apple Design Award for Postage. Chris's new company is Aged & Distilled
  12. with Guy English - which shipped Napkin, a Mac app for visual collaboration.
  13. Chris is also the co-host of The Record. He lives on Bainbridge Island,
  14. a quick ferry ride from Seattle.`
  15. content_html = `Chris has worked at <a href="http://adobe.com/">Adobe</a> and as a founder of Rogue Sheep,
  16. which won an Apple Design Award for Postage. Chris's new company is Aged & Distilled
  17. with Guy English - which shipped <a href="http://aged-and-distilled.com/napkin/">Napkin</a>,
  18. a Mac app for visual collaboration. Chris is also the co-host of The Record.
  19. He lives on <a href="http://www.ci.bainbridge-isl.wa.us/">Bainbridge Island</a>,
  20. a quick ferry ride from Seattle.`
  21. summary = 'Brent interviews Chris Parrish, co-host of The Record and one-half of Aged & Distilled.'
  22. date_published = 2014-05-09T14:04:00-07:00
  23. attachments =
  24. < url = http://therecord.co/downloads/The-Record-sp1e1-ChrisParrish.m4a
  25. mime_type = audio/x-m4a
  26. size_in_bytes = 89_970_236
  27. duration_in_seconds = 6_629
  28. >
  29. >

the same as ye old’ “vanilla” JSON:

  1. {
  2. "version": "https://jsonfeed.org/version/1",
  3. "user_comment": "This is a podcast feed. You can add this feed to your podcast client using the following URL: http://therecord.co/feed.json",
  4. "title": "The Record",
  5. "home_page_url": "http://therecord.co/",
  6. "feed_url": "http://therecord.co/feed.json",
  7. "items": [
  8. {
  9. "id": "http://therecord.co/chris-parrish",
  10. "title": "Special #1 - Chris Parrish",
  11. "url": "http://therecord.co/chris-parrish",
  12. "content_text": "Chris has worked at Adobe and as a founder of Rogue Sheep, which won an Apple Design Award for Postage. Chris's new company is Aged & Distilled with Guy English - which shipped Napkin, a Mac app for visual collaboration. Chris is also the co-host of The Record. He lives on Bainbridge Island, a quick ferry ride from Seattle.",
  13. "content_html": "Chris has worked at <a href=\"http://adobe.com/\">Adobe</a> and as a founder of Rogue Sheep, which won an Apple Design Award for Postage. Chris's new company is Aged & Distilled with Guy English - which shipped <a href=\"http://aged-and-distilled.com/napkin/\">Napkin</a>, a Mac app for visual collaboration. Chris is also the co-host of The Record. He lives on <a href=\"http://www.ci.bainbridge-isl.wa.us/\">Bainbridge Island</a>, a quick ferry ride from Seattle.",
  14. "summary": "Brent interviews Chris Parrish, co-host of The Record and one-half of Aged & Distilled.",
  15. "date_published": "2014-05-09T14:04:00-07:00",
  16. "attachments": [
  17. {
  18. "url": "http://therecord.co/downloads/The-Record-sp1e1-ChrisParrish.m4a",
  19. "mime_type": "audio/x-m4a",
  20. "size_in_bytes": 89970236,
  21. "duration_in_seconds": 6629
  22. }
  23. ]
  24. }
  25. ]
  26. }

More Feed Formats

  • Feed.TXT - free feeds format in plain text w/ structured meta data
  • Feed.HTML - free feeds format in hypertext markup language (html) w/ structured meta data
  • For more formats see the Formats @ Awesome Feeds collection.

Meta

License

The JSON v1.1 Feed format is dedicated to the public domain. Use it as you please with no restrictions whatsoever.

Questions? Comments?

Post them to the wwwmake forum. Thanks!