RouR / JsonFeed.NET

JsonFeed.NET is a portable .NET library for generating and consuming JSON Feed (jsonfeed.org) compliant site feeds.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JsonFeed.NET v0.2.1

JsonFeed.NET is a portable .NET library for generating and consuming JSON Feed compliant site feeds.

NuGet Pre Release Twitter Follow

Supported platforms

  • .NET Framework 4.5.1+
  • .NET Core 1.1+
  • Mono
  • UWP
  • Xamarin.iOS
  • Xamarin.Android

How To Install

Install-Package JsonFeed.NET

Sample Usage

Parsing a JsonFeed from a string

JsonFeed jsonFeed = JsonFeed.Parse(jsonFeedString);

Parsing a JsonFeed from a Url

JsonFeed jsonFeed = await JsonFeed.ParseFromUriAsync(new Uri("https://jsonfeed.org/feed.json"));

Parsing a JsonFeed from a Url using a custom HttpMessageHandler

JsonFeed jsonFeed = await JsonFeed.ParseFromUriAsync(new Uri("https://jsonfeed.org/feed.json"), new HttpClientHandler());

Creating a new JsonFeed and writing it to a string

var jsonFeed = new JsonFeed
{
    Title = "Dan Rigby",
    Description = "Mobile App Development & More.",
    HomePageUrl = @"http://danrigby.com",
    FeedUrl = @"http://danrigby.com/feed.json",
    Author = new JsonFeedAuthor
    {
        Name = "Dan Rigby",
        Url = @"https://twitter.com/DanRigby",
    },
    Items = new List<JsonFeedItem>
    {
        new JsonFeedItem
        {
            Id = @"http://danrigby.com/2015/09/12/inotifypropertychanged-the-net-4-6-way/",
            Url = @"http://danrigby.com/2015/09/12/inotifypropertychanged-the-net-4-6-way/",
            Title = "INotifyPropertyChanged, The .NET 4.6 Way",
            ContentText = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
            DatePublished = new DateTime(2015, 09, 12)
        }
    }
};

string jsonFeedString = jsonFeed.Write();

Writing a JsonFeed to a stream

JsonFeed jsonFeed = JsonFeed.Parse(inputJsonFeed);
jsonFeed.Write(stream);

License

Copyright (c) 2017 Dan Rigby

Licensed under the MIT license.

About

JsonFeed.NET is a portable .NET library for generating and consuming JSON Feed (jsonfeed.org) compliant site feeds.

License:MIT License


Languages

Language:C# 100.0%