JSON Feed and Converting Channels

@hpdean and @matrixebiz Trying both your samples I get the error “The server returned an unsupported content type.” Is there a trick to saving JSON code? I’m using Notepad++ and saved as JSON. The file is located on a public Dropbox folder.

Confused in L.A.

“islanddreamer” wrote:
@hpdean and @matrixebiz Trying both your samples I get the error “The server returned an unsupported content type.” Is there a trick to saving JSON code? I’m using Notepad++ and saved as JSON. The file is located on a public Dropbox folder.

Confused in L.A.
I am not really sure if it is absolutely necessary to save as json, but that is what I did and it worked. I would just edit the text in notepad and then save it and then rename it to {name}.json. Also, what url did you use? Was it one that ended with “dl-0” or “dl=1”?

@hpdean That’s what I did, more or less, with no luck. The URL is just a standard dropbox URL (which works with standard RSS feed). No dl=1 or dl=0 at the end of it.

you need to add the json mime type to your server…

Add the mime type to each mp4 video or to the bucket? Searching online to see if this can be done using cloudberry to S3

“newchannel” wrote:
Add the mime type to each mp4 video or to the bucket? Searching online to see if this can be done using cloudberry to S3
What is it you’re trying to do - get your JSON feed file accessible from S3?

Hi Belltown,
Correct. I use S3 (of course xml files on s3 of which I need to make a json file and add the video links). From what I have learned so far I can use the sample json file I have and add my own links etc to it. I will use jsonlint.com to validate it first. Then, place the json file on my s3 server. I use cloudberry to access the s3. Does a json file get added to a bucket just like I would add an xml file?

Don’t know anything about mime type or how to apply that and if it applies to the each json file, or the bucket a json file would be in. And, once the file is on the server and all ready, I use the url of the json file for the direct publisher? Do I have any part of this correct?

Thank you.

You’re on the right track. I don’t know anything about a Cloud Berry, but if you can get your JSON feed file somehow into S3, here’s how you set the Content-Type to application/json, a requirement for it to work on Direct Publisher (you can also use the AWS Management Console to upload the file from your computer to an S3 bucket):

  • Sign in to your AWS Management Console from a web browser
  • Select S3
  • Click on the link for your bucket
  • Click on the link for the object (your feed.json file)
  • Click on the Properties tab
  • Click on Metadata
  • Click on Add Metadata
  • Click on Select a key, then select Content-Type from the dropdown list
  • In the text box to the right of Content-Type, enter application/json
  • Click on Save

And you’re correct in that once all this is set up, you use the link to your feed’s .json file in Direct Publisher.

Note that you should also check that your file permissions are set to allow anyone to read the .json file. In the AWS console, the next tab over from Properties is Permissions. Under Access Control List/Manage public permissions, set the object access to Read for Everyone.

Thank you Belltown. A huge help. I see in aws where the steps are that you described. Once I can get all of my channel files added to the json will add to the s3 and do a test run.
Appreciate it very much.

Beltown,

I went to the aws panel to change the metadata. Once into the bucket and at the json file, under metadata there wasnt a choice for application/json but using cloudberry to access my buckets, I was able to change the content-type that way to the application/json For some reason the drop down list wouldn’t let me type in what I wanted and click save. But it does now show as content-type application/json

I set up a test channel on direct publisher and put in the feed url. Roku tells me this:

JSON (SyntaxError: Unexpected token  in JSON at position 0)

The json file I am testing is a roku json file and I put it into jsonlint and it shows it is valid. Below is the json file from roku that I am testing. Any suggestions"

Thank you.

{
 "providerName": "Roku Recommends",
 "language": "en-US",
 "lastUpdated": "2016-10-06T18:12:32.125Z",
 "shortFormVideos": [{
 "id": "decbe34b64ea4ca281dc09997d0f23fd",
 "title": "Live Gaming",
 "shortDescription": "With the Twitch channel, you can watch the most popular broadcasts of the day, browse live broadcasts by the games you love and follow your favorite Twitch broadcasters.",
 "thumbnail": "https://blog.roku.com/developer/files/2016/10/twitch-poster-artwork.png",
 "genres": ["gaming", "technology"],
 "tags": ["gaming", "broadcasts", "live", "twitch", "technology"],
 "releaseDate": "2015-06-11",
 "content": {
 "dateAdded": "2015-06-11T14:14:54.431Z",
 "captions": [],
 "duration": 53,
 "adBreaks": ["00:00:00", "00:00:53"],
 "videos": [{
 "url": "http://roku.cpl.delvenetworks.com/media/59021fabe3b645968e382ac726cd6c7b/decbe34b64ea4ca281dc09997d0f23fd/aac0cfc54ae74fdfbb3ba9a2ef4c7080/117_segment_2_twitch__nw_060515.mp4",
 "quality": "HD",
 "videoType": "MP4"
 }]
 }
 }, {
 "id": "6c9d0951d6d74229afe4adf972b278dd",
 "title": "Let's Get Cookin'",
 "shortDescription": "The Paula Deen Channel is your instant access to Paula Deen’s new and hilarious cooking and lifestyle shows. Paula and her sons,  Jamie and Bobby, will cook up their delicious southern recipes and help you with hints and tips that make meal planning simple, affordable and easy.",
 "thumbnail": "https://blog.roku.com/developer/files/2016/10/paula-deen-poster-artwork.png",
 "genres": ["food"],
 "tags": ["food", "cooking", "eating"],
 "releaseDate": "2015-05-21",
 "content": {
 "dateAdded": "2015-05-21T14:14:54.431Z",
 "captions": [],
 "duration": 59,
 "adBreaks": ["00:00:00", "00:00:59"],
 "videos": [{
 "url": "http://roku.cpl.delvenetworks.com/media/59021fabe3b645968e382ac726cd6c7b/6c9d0951d6d74229afe4adf972b278dd/bc227724e2854c6b93ad48d1feb39c16/roku_ep_115_segment_5_paula_nw_050515.mp4",
 "quality": "HD",
 "videoType": "MP4"
 }]
 }
 }, {
 "id": "7405a8c101ee4c9da312c426e6067044",
 "title": "Ideas Worth Spreading",
 "shortDescription": "TED is a nonprofit devoted to Ideas Worth Spreading. On this channel, you’ll find TEDTalks video to inspire, intrigue and stir the imagination from some of the world’s leading thinkers and doers, speaking from the stage at TED conferences, TEDx events and partner events around the world.",
 "thumbnail": "https://blog.roku.com/developer/files/2016/10/ted-poster-artwork.png",
 "genres": ["educational", "science"],
 "tags": ["educational", "science", "innovation"],
 "releaseDate": "2015-05-21",
 "content": {
 "dateAdded": "2015-05-21T14:14:54.431Z",
 "captions": [],
 "duration": 71,
 "adBreaks": ["00:00:00", "00:01:11"],
 "videos": [{
 "url": "http://roku.cpl.delvenetworks.com/media/59021fabe3b645968e382ac726cd6c7b/7405a8c101ee4c9da312c426e6067044/dc0d29c5dde34565a3be95987f2956fe/roku_ep_115_segment_1_ted_nw_050515.mp4",
 "quality": "HD",
 "videoType": "MP4"
 }]
 }
 }, {
 "id": "5686748268874a57a4ba3debda1619dd",
 "title": "Fanboys Unite",
 "shortDescription": "ConTv is a channel that promises to let you \"immerse yourself in the Comic Con experience.\" The channel offers Sci-fi and monster movies, cult classics, martial arts, hit television series from years past, and more.",
 "thumbnail": "https://blog.roku.com/developer/files/2016/10/con-tv-poster-artwork.png",
 "genres": ["science fiction"],
 "tags": ["science fiction", "Comics", "cult"],
 "releaseDate": "2015-08-13",
 "content": {
 "dateAdded": "2015-08-13T14:14:54.431Z",
 "captions": [],
 "duration": 63,
 "adBreaks": ["00:00:00", "00:01:03"],
 "videos": [{
 "url": "http://roku.cpl.delvenetworks.com/media/59021fabe3b645968e382ac726cd6c7b/5686748268874a57a4ba3debda1619dd/75ad4598ef4a4e5c950e26d80464abb4/ep-126-seg-3_contv_v1-mo.mp4",
 "quality": "HD",
 "videoType": "MP4"
 }]
 }
 }, {
 "id": "37d290e03d894135b07c5e514cbad72d",
 "title": "Fight Pass",
 "shortDescription": "UFCTV gives you Live and On-Demand access to UFC events and classic fights. UFC (Ultimate Fighting Championship), is the world’s leading mixed martial arts sports association.",
 "thumbnail": "https://blog.roku.com/developer/files/2016/10/ufc-poster-artwork.png",
 "genres": ["sports"],
 "tags": ["MMA", "sports", "Fighting"],
 "releaseDate": "2015-05-28",
 "content": {
 "dateAdded": "2015-05-28T14:14:54.431Z",
 "captions": [],
 "duration": 52,
 "adBreaks": ["00:00:00", "00:00:52"],
 "videos": [{
 "url": "http://roku.cpl.delvenetworks.com/media/59021fabe3b645968e382ac726cd6c7b/37d290e03d894135b07c5e514cbad72d/dfd02160a5374c39967c105a8cfff3a1/roku_ep_115_segment_3_ufc_nw_051815.mp4",
 "quality": "HD",
 "videoType": "MP4"
 }]
 }
 }, {
 "id": "42137542fa884b97a2a72cb356ae21b9",
 "title": "Giant Sharks And More",
 "shortDescription": "The best collection of high-quality documentary programs anywhere. History, science, space, nature, adventure - XiveTV has it all. From sharks and war, to UFOs and black holes, and much more!",
 "thumbnail": "https://blog.roku.com/developer/files/2016/10/xive-poster-artwork.png",
 "genres": ["history", "science", "nature", "adventure"],
 "tags": ["History", "science", "nature", "adventure", "Space"],
 "releaseDate": "2015-07-02",
 "content": {
 "dateAdded": "2015-07-02T14:14:54.431Z",
 "captions": [],
 "duration": 67,
 "adBreaks": ["00:00:00", "00:01:07"],
 "videos": [{
 "url": "http://roku.cpl.delvenetworks.com/media/59021fabe3b645968e382ac726cd6c7b/42137542fa884b97a2a72cb356ae21b9/57316de2eaa3448b8376ef0b1ff58d46/roku_119_segment_2_062315.mp4",
 "quality": "HD",
 "videoType": "MP4"
 }]
 }
 }, {
 "id": "7ec4711dc886464fa16001c1962904f8",
 "title": "Get Your Game Face On",
 "shortDescription": "Accessing your favorite live sports and shows from ESPN is now easier than ever with WatchESPN. WatchESPN brings you 24/7 live programming from your favorite ESPN networks, including: ESPN, ESPN2, ESPN3, ESPNU, SEC Network, SEC Network +, ESPNews, ESPN Deportes, Longhorn Network, ESPN Goal Line, ESPN Buzzer Beater, and ESPN Bases Loaded.",
 "thumbnail": "https://blog.roku.com/developer/files/2016/10/espn-poster-artwork.png",
 "genres": ["sports"],
 "tags": ["sports", "baseball", "football", "tennis"],
 "releaseDate": "2015-08-27",
 "content": {
 "dateAdded": "2015-08-27T14:14:54.431Z",
 "captions": [],
 "duration": 48,
 "adBreaks": ["00:00:00", "00:00:48"],
 "videos": [{
 "url": "http://roku.cpl.delvenetworks.com/media/59021fabe3b645968e382ac726cd6c7b/7ec4711dc886464fa16001c1962904f8/f0f6be8be9f145dc876d18872ba746fe/rr_ep_124_segment_2_080315_h264.mp4",
 "quality": "HD",
 "videoType": "MP4"
 }]
 }
 }, {
 "id": "2c4e8ea1ad2f4a8d9d244f5dd4cc47b6",
 "title": "Get Slimed",
 "shortDescription": "Nickelodeon, the number-one entertainment brand for kids, is now available for free on Roku players and Roku TV models in the U.S.",
 "thumbnail": "https://blog.roku.com/developer/files/2016/10/nickelodeon-poster-artwork.png",
 "genres": ["children"],
 "tags": ["children", "kids"],
 "releaseDate": "2015-08-13",
 "content": {
 "dateAdded": "2015-08-13T14:14:54.431Z",
 "captions": [],
 "duration": 52,
 "adBreaks": ["00:00:00", "00:00:52"],
 "videos": [{
 "url": "http://roku.cpl.delvenetworks.com/media/59021fabe3b645968e382ac726cd6c7b/2c4e8ea1ad2f4a8d9d244f5dd4cc47b6/d6217d5a03e64cef9e6bf889fda8d41c/ep-123-seq-4-nick-alt_081215.mp4",
 "quality": "HD",
 "videoType": "MP4"
 }]
 }
 }, {
 "id": "a4d29aebf55e499c968ce02469859637",
 "title": "College Sports",
 "shortDescription": "The Campus Insiders Roku channel provides college sports fans with videos covering college basketball and college football.",
 "thumbnail": "https://blog.roku.com/developer/files/2016/10/campus-insider-poster-artwork.png",
 "genres": ["sports"],
 "tags": ["sports", "football", "college", "basketball"],
 "releaseDate": "2015-04-30",
 "content": {
 "dateAdded": "2015-04-30T14:14:54.431Z",
 "captions": [],
 "duration": 64,
 "adBreaks": ["00:00:00", "00:01:04"],
 "videos": [{
 "url": "http://roku.cpl.delvenetworks.com/media/59021fabe3b645968e382ac726cd6c7b/a4d29aebf55e499c968ce02469859637/1436ec35d7984170b428141579add3c2/roku_ep_113_segment_3_college_insiders_042415.mp4",
 "quality": "HD",
 "videoType": "MP4"
 }]
 }
 }, {
 "id": "69ce40b268fa4766aa1612131aa74898",
 "title": "Cult Scary Movies",
 "shortDescription": "The Cult Movie network has it all, 24 hours a day, seven days a week. Watch the cult films you can't find anywhere else on television - if you're into that sort of thing.",
 "thumbnail": "https://blog.roku.com/developer/files/2016/10/cult-movie-network-poster-artwork.png",
 "genres": ["science fiction", "thriller"],
 "tags": ["cult", "Sci-fi", "thriller"],
 "releaseDate": "2015-11-05",
 "content": {
 "dateAdded": "2015-11-05T14:14:54.431Z",
 "captions": [],
 "duration": 96,
 "adBreaks": ["00:00:00", "00:01:36"],
 "videos": [{
 "url": "http://roku.cpl.delvenetworks.com/media/59021fabe3b645968e382ac726cd6c7b/69ce40b268fa4766aa1612131aa74898/f9402439b3bb46028bcb3421821cadbf/roku-recommends_new.mp4",
 "quality": "HD",
 "videoType": "MP4"
 }]
 }
 }],
 "playlists": [{
 "name": "sports",
 "itemIds": ["a4d29aebf55e499c968ce02469859637", "7ec4711dc886464fa16001c1962904f8", "37d290e03d894135b07c5e514cbad72d", "decbe34b64ea4ca281dc09997d0f23fd"]
 }, {
 "name": "misc",
 "itemIds": ["6c9d0951d6d74229afe4adf972b278dd", "7405a8c101ee4c9da312c426e6067044", "5686748268874a57a4ba3debda1619dd", "42137542fa884b97a2a72cb356ae21b9", "69ce40b268fa4766aa1612131aa74898", "2c4e8ea1ad2f4a8d9d244f5dd4cc47b6"]
 }, {
 "name": "short-form",
 "itemIds": ["decbe34b64ea4ca281dc09997d0f23fd", "6c9d0951d6d74229afe4adf972b278dd", "7405a8c101ee4c9da312c426e6067044", "5686748268874a57a4ba3debda1619dd", "37d290e03d894135b07c5e514cbad72d", "42137542fa884b97a2a72cb356ae21b9", "7ec4711dc886464fa16001c1962904f8", "a4d29aebf55e499c968ce02469859637", "69ce40b268fa4766aa1612131aa74898", "2c4e8ea1ad2f4a8d9d244f5dd4cc47b6"]
 }],
 "categories": [{
 "name": "Roku Recommends",
 "playlistName": "short-form",
 "order": "manual"
 }, {
 "name": "Sports \u0026 Gaming",
 "playlistName": "sports",
 "order": "manual"
 }, {
 "name": "Miscellaneous",
 "playlistName": "misc",
 "order": "manual"
 }]
}

I put the json on myjson.com and then tried it again in DP. The url worked fine.

So, it must be something to do with amazon s3 that is causing the error when I use the url of the json file saved in the s3 bucket? Any idea what how to fix this so I can use s3 to store the json files?
JSON (SyntaxError: Unexpected token  in JSON at position 0)

EDIT SOLVED
Apparently it was something odd with how I had used notepad to make the json file. To correct the problem, I copied the json file I had gotten from the forum to test and pasted it into jedit and saved as a .json file. Then, saved to the aws s3 bucket and used the url of the json file in the bucket in the feed area on DP and it worked!

Follow the Direct Publisher schema to build a valid JSON file.

https://github.com/rokudev/feed-specifi … ication.md

Use a linter, like jsonlint.com, to validate your file. It’s easier to build in a text editor (or an integrated development environment) that calls out syntax errors and color codes. Cloud 9 (c9.io) is low-cost (free for public) and is web-based.

JSON is pretty simple. Basically it’s a text-based database, with the object being a key:value pair between two curly brackets { “name”: “Larry” }. A group of objects can be contained in an array, e.g., [ {“name”: “Larry”}, {“name”: “Frank”} ]. Objects and arrays are separated from each other by commas. Keys are strings, and must be put in quotes. Values may be strings, and should be in quotes if they are. If they are integers, do not put them in quotes. Objects can be nested within other objects, which is where the syntax gets confusing. An IDE can help identify opening and closing brackets, and a linter will call them out as well.

The schema has examples. I would start with the Direct Publisher Root Object example:

https://github.com/rokudev/feed-specifications/blob/master/direct-publisher-feed-specification.md#direct-publisher-feed-schema

…and add your child objects directly copied from their example, like with the movies schema example.

https://github.com/rokudev/feed-specifi … n.md#movie

Make sure your file has a file tag .json and is of the type application/json in the meta-data, not binary.

stubbstarbuck,

Thank you for explaining this. Great information. Helps to break it down piece by piece.