Method: ArticleJSON::Export::AppleNews::Exporter#to_json

Defined in:
lib/article_json/export/apple_news/exporter.rb

#to_jsonString

Return the components section of an Apple News Article as JSON

Images and EmbededVideos are nested in an array with the components array when they contain captions. As Apple News skips over these nested arrays, we must flatten the array.



17
18
19
# File 'lib/article_json/export/apple_news/exporter.rb', line 17

def to_json
  { components: components.flatten }.to_json
end