News in JSON
Stuart Myles * Associated Press * 7th November 2017
© 2017 IPTC (www.iptc.org) All rights reserved
https://flic.kr/p/kAXGfC
News in JSON Activity
http://www.flickr.com/photos/jondresner/5789254800/
News In JSON Activity
http://www.flickr.com/photos/jondresner/5789254800/
Remind Me: News in JSON?
Lightweight, easy to parse format
Increasingly popular alternative to / replacement for XML
Two principle use cases:
data interchange (e.g. APIs) with an emphasis on partial representation
data at rest (e.g. search engines like Elastic Search or MongoDB)
Not simply translating from any existing XML standard into JSON
Determine how to represent key properties and structures
Hand crafted, rather than mechanically translating from XML into JSON
Goal: comprehensive standard, lightweight instance documents
© 2015 IPTC (www.iptc.org) All rights reserved 3
ninjs Overview
© 2015 IPTC (www.iptc.org) All rights reserved 4
http://groups.yahoo.com/neo/groups/iptc-news-in-json-dev
ninjs Data Model
© 2015 IPTC (www.iptc.org) All rights reserved 5
http://dev.iptc.org/ninjs
News in JSON
• We reviewed existing sets of news properties including
– NewsML-G2
– NewsML 1
– rNews
– NITF
• We selected a set of priority properties to represent
• https://docs.google.com/spreadsheet/ccc?key=0AvnUbL
xJqDwBdGxOQXdYeTRPM2k3WFhiNGRuMWR2M1E
• We will add more later...
• ...but we wanted to start somewhere
© 2014 IPTC (www.iptc.org) All rights reserved 6
ninjs 1.1
• ninjs is a JSON representation of a news item
– Text, Photo, Graphic, Video, Audio, Package
• You can represent a complete item, with all properties
– For instance in an internal CMS like MongoDB
• Or you may want to convey key properties
– For instance as an API response
• The representationtype property indicates how complete
– Either “full” or “partial”
• Associations are themselves ninjs documents
– You may include complete or partial representations
© 2015 IPTC (www.iptc.org) All rights reserved 7
A Complete NINJS 1.1 Article
{
"uri" : "http://ninjs.example.com/newsitems/20130709simp123",
"type" : "text",
"versioncreated" : "2013-07-09T10:37:00Z",
"byline" : "Paulo Santalucia and Frances d'Emilio",
"headline" : "Captain of wrecked cruise ship on trial in
Italy",
"body_text" : "GROSSETO, Italy (EP) -- The trial of the
captain of the shipwrecked Costa Concordia cruise liner has begun
in a theater converted into a courtroom …"
}
© 2015 IPTC (www.iptc.org) All rights reserved 8
Things We Considered But
Decided Against
• Translating from an existing XML standard into JSON
– Not all IPTC standards are XML
– Not all publishers use the same IPTC standards
– Not all publishers use any IPTC standards
• “Mechanically” translating from XML into JSON
– There are many libraries that can do this
– Different choices for how to represent certain XML features
– So each technique results in a slightly different JSON
– We felt that more a more “natural” JSON would be more valuable
© 2014 IPTC (www.iptc.org) All rights reserved 9
What We Learnt from Crafting
ninjs (1/2)
• Simpler JSON Means Simpler Code
• Choose Wisely: Once You Commit to a Structure,
You Can't Change It (Easily)
• It is annoying to have an array if there's only ever
one item
• Use the headline / headlines "cheat"
• Flatter is better
• https://stuartmyles.blogspot.com/2014/08/json-
design-principles-and-lessons.html
© 2017 IPTC (www.iptc.org) All rights reserved 10
What We Learnt from Crafting
ninjs (2/2)
• Use pattern properties to strike a balance between
flexibility and interoperability
• Start property labels with a lower case letter
• Use a very restricted set of characters when naming
properties
• Inline text markup alternatives
• Support APIs with a full / partial representation
indicator
• https://stuartmyles.blogspot.com/2014/08/json-
design-principles-and-lessons.html
© 2017 IPTC (www.iptc.org) All rights reserved 11
ninjs Change Requests
• We now have 29 change requests for ninjs
• http://dev.iptc.org/ninjs-Internal-HP
• Most would likely be straightforward adds to the current
structure
– Still require discussion over the best approach
• Some are looking for alterations to existing structures
– These would therefore be incompatible
• PROPOSAL:
– Create a ninjs 1.2 with the “easy” changes
– Consider a ninjs 2.0 for bigger changes
• Requires the revival of the long dormant ninjs group
© 2010 IPTC (www.iptc.org) All rights reserved 12
Date and Place of Next Meeting
Athens 23rd – 25th April 2018
https://flic.kr/p/atFSAr
ευχαριστώ και αντίο!!
© 2017 IPTC (www.iptc.org) All rights reserved 13

IPTC News in JSON November 2017

  • 1.
    News in JSON StuartMyles * Associated Press * 7th November 2017 © 2017 IPTC (www.iptc.org) All rights reserved https://flic.kr/p/kAXGfC
  • 2.
    News in JSONActivity http://www.flickr.com/photos/jondresner/5789254800/ News In JSON Activity http://www.flickr.com/photos/jondresner/5789254800/
  • 3.
    Remind Me: Newsin JSON? Lightweight, easy to parse format Increasingly popular alternative to / replacement for XML Two principle use cases: data interchange (e.g. APIs) with an emphasis on partial representation data at rest (e.g. search engines like Elastic Search or MongoDB) Not simply translating from any existing XML standard into JSON Determine how to represent key properties and structures Hand crafted, rather than mechanically translating from XML into JSON Goal: comprehensive standard, lightweight instance documents © 2015 IPTC (www.iptc.org) All rights reserved 3
  • 4.
    ninjs Overview © 2015IPTC (www.iptc.org) All rights reserved 4 http://groups.yahoo.com/neo/groups/iptc-news-in-json-dev
  • 5.
    ninjs Data Model ©2015 IPTC (www.iptc.org) All rights reserved 5 http://dev.iptc.org/ninjs
  • 6.
    News in JSON •We reviewed existing sets of news properties including – NewsML-G2 – NewsML 1 – rNews – NITF • We selected a set of priority properties to represent • https://docs.google.com/spreadsheet/ccc?key=0AvnUbL xJqDwBdGxOQXdYeTRPM2k3WFhiNGRuMWR2M1E • We will add more later... • ...but we wanted to start somewhere © 2014 IPTC (www.iptc.org) All rights reserved 6
  • 7.
    ninjs 1.1 • ninjsis a JSON representation of a news item – Text, Photo, Graphic, Video, Audio, Package • You can represent a complete item, with all properties – For instance in an internal CMS like MongoDB • Or you may want to convey key properties – For instance as an API response • The representationtype property indicates how complete – Either “full” or “partial” • Associations are themselves ninjs documents – You may include complete or partial representations © 2015 IPTC (www.iptc.org) All rights reserved 7
  • 8.
    A Complete NINJS1.1 Article { "uri" : "http://ninjs.example.com/newsitems/20130709simp123", "type" : "text", "versioncreated" : "2013-07-09T10:37:00Z", "byline" : "Paulo Santalucia and Frances d'Emilio", "headline" : "Captain of wrecked cruise ship on trial in Italy", "body_text" : "GROSSETO, Italy (EP) -- The trial of the captain of the shipwrecked Costa Concordia cruise liner has begun in a theater converted into a courtroom …" } © 2015 IPTC (www.iptc.org) All rights reserved 8
  • 9.
    Things We ConsideredBut Decided Against • Translating from an existing XML standard into JSON – Not all IPTC standards are XML – Not all publishers use the same IPTC standards – Not all publishers use any IPTC standards • “Mechanically” translating from XML into JSON – There are many libraries that can do this – Different choices for how to represent certain XML features – So each technique results in a slightly different JSON – We felt that more a more “natural” JSON would be more valuable © 2014 IPTC (www.iptc.org) All rights reserved 9
  • 10.
    What We Learntfrom Crafting ninjs (1/2) • Simpler JSON Means Simpler Code • Choose Wisely: Once You Commit to a Structure, You Can't Change It (Easily) • It is annoying to have an array if there's only ever one item • Use the headline / headlines "cheat" • Flatter is better • https://stuartmyles.blogspot.com/2014/08/json- design-principles-and-lessons.html © 2017 IPTC (www.iptc.org) All rights reserved 10
  • 11.
    What We Learntfrom Crafting ninjs (2/2) • Use pattern properties to strike a balance between flexibility and interoperability • Start property labels with a lower case letter • Use a very restricted set of characters when naming properties • Inline text markup alternatives • Support APIs with a full / partial representation indicator • https://stuartmyles.blogspot.com/2014/08/json- design-principles-and-lessons.html © 2017 IPTC (www.iptc.org) All rights reserved 11
  • 12.
    ninjs Change Requests •We now have 29 change requests for ninjs • http://dev.iptc.org/ninjs-Internal-HP • Most would likely be straightforward adds to the current structure – Still require discussion over the best approach • Some are looking for alterations to existing structures – These would therefore be incompatible • PROPOSAL: – Create a ninjs 1.2 with the “easy” changes – Consider a ninjs 2.0 for bigger changes • Requires the revival of the long dormant ninjs group © 2010 IPTC (www.iptc.org) All rights reserved 12
  • 13.
    Date and Placeof Next Meeting Athens 23rd – 25th April 2018 https://flic.kr/p/atFSAr ευχαριστώ και αντίο!! © 2017 IPTC (www.iptc.org) All rights reserved 13