Code Monkey home page Code Monkey logo

jil's People

Contributors

aureliengasser avatar bretcope avatar breyed avatar cris-almodovar avatar davidkarlas avatar inpermutation avatar jack-pappas avatar jasonpunyon avatar joshjje avatar kevin-montrose avatar m0sa avatar manofstick avatar mgravell avatar nickcraver avatar scooletz avatar thexenocide avatar wazner avatar yellis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jil's Issues

Make ISO8601 default DateTime format

Can we please leave the past behind and leave the bastardized non standard \/Date(...)\/ notation in for the historians and masochists?

It is great to have the optional configuration for backwards compatibility but it should not be the default.

The crazy non-standard format wasn't even invented by Newtonsoft.Json. They took it from JavascriptSerializer. http://james.newtonking.com/json/help/index.html?topic=html/DatesInJSON.htm

For the happiness of future generationa let's not propagate this non-sense further more.

DeserializationException gives no indication where in problem is

And that's terrible for debuggig. Like, really really godawfully bad.

I figure I should grab the next few (50?) characters in the stream at least so you've got something to grep for. Maybe try to grab an absolute position if the stream is of a known type as well.

"Deep" Object Graphs get serialized as "{}"

I am not entirely sure whether this is a bug in Jil or me expecting a feature that is not there, but after exchaning Json.Net with Jil in a project, I got unit test errors stating that the returning Json was empty (as in "{}") but actual serialized objects were expected.

I've created a Gist to reproduce this with Jil 2.1.0 but basically what's going on there is an attempt to serialize an object that has 2 inheritance levels ('UserCredentialsUpdateResponse' > 'UserResponse' > 'Response') and that 'UserResponse' class has a '.User' property whose type also has one inheritance level (the types are simplified but those are levels of nestings actually going on).

When serializing an instance of 'UserCredentialsUpdateResponse' I'd expect it to serialize the graph, but I get '{}' back from the Jil.JSON.Serialize(..) call.. which is odd.

The sample Test / repro is here: https://gist.github.com/jbattermann/9589865db33742e2280b

Is my object graph simply unsupported or 'should' this work?

Can deserialize deep-inheritance class hierarchy?

Our data entities have a long chain of inherited classes. Serializing them with includeInherited: true option appears to be ok, but when deserializing all the property values are null or default.

Does Jil reflect into all the inherited classes' declarations?

Formatting bug on first element in a dictionary

@KevinMontrose a slight oddity I notice in JIL - when serializing a dictionary, the first item seems to have slightly different spacing
for example:
""tags"": {
""host"":""test"",
""role"": ""coreqa"",
""tier"": ""local""
},
(this is with formatting enabled, obviously)
doesn't break the json in any way - just thought you'd want to know
(I have updated to JIL latest; still occurs)

TimeSpan serialization not supported

JSON.Serialize(new TimeSpan(1, 2, 3, 4, 20))

returns

{
 "Ticks": 937840200000,
 "Days": 1,
 "Hours": 2,
 "Milliseconds": 20,
 "Minutes": 3,
 "Seconds": 4,
 "TotalDays": 1.08546319444444,
 "TotalHours": 26.0511166666667,
 "TotalMilliseconds": 93784020,
 "TotalMinutes": 1563.067,
 "TotalSeconds": 93784.02
}

Deserialization failure when a JilDirective gives a property the same name as a different property

The code below may be easier to understand than a description, but here goes...

If a class contains a property which is not serialized via [IgnoreDataMember] or [JilDirective(Ignore=true)], and then another property is given that same name via [JilDirective(Name="firstPropertyName")] then deserialization fails. I think this is because the MemberMatcher is trying to put them both into a dictionary with the same name.

The reason I want to do this is to serialize a member (in my case a NodaTime LocalDate) in a non-default way. Hiding the "real" member and adding a another member that exposes the formatted string value is a workaround to allow custom formatting.

Here is minimal repro code:

public class NameConflicter
{
    [Jil.JilDirective(Ignore = true)]
    public DateTime NotSerializedProperty { get; set; }

    [Jil.JilDirective(Name = "NotSerializedProperty")]
    public string SerializedProperty { get; set; }
}

[Test]
public void JilNameConflictTest()
{
        Jil.JSON.Deserialize<NameConflicter>("{}");
}

The exception thrown is:

Jil.DeserializationException : Exception has been thrown by the target of an invocation.
        ----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
        ----> System.TypeInitializationException : The type initializer for 'Jil.Deserialize.MemberMatcher`1' threw an exception.
        ----> System.ArgumentException : An item with the same key has already been added.
        at Jil.JSON.Deserialize[T](TextReader reader, Options options)
        at Jil.JSON.Deserialize[T](String text, Options options)

By the way, the workaround for the workaround is to rename the hidden property to something else. Doesn't make for the cleanest code, but it works.

#46 vs your changes to use unsafe?

Did you disagree with the assumptions in pull request "Faster _WriteEncodedString*" (i.e. that most string don't include escapable characters?)

(Just that your changes with the unsafe make them unmergeable; and I haven't tried it; but I assume this is for a marginal improvement - whereas if the assumption is correct them a single Write(string) is much much faster than many Write(char)s...)

DeserializeDynamic bug?

DeserializeDynamic in JilTests.DeserializeDynamicTests.ObjectEnumeration() working right

copy ObjectEnumeration code to new ConsoleApplication

    static void Main(string[] args)
    {
        using (var str = new StringReader("{\"hello\":123, \"world\":456, \"foo\":789}"))
        {
            var c = 0;
            var res = JSON.DeserializeDynamic(str);
            foreach (var kv in res)
            {
                string key = kv.Key;
                dynamic val = kv.Value;
            }
        }
    }

reference Jil and Sigil

this code string key = kv.Key; throw Microsoft.CSharp.RuntimeBinder.RuntimeBinderException message "System.ValueType" does not contain "Key" is defined

Questions regarding performance

I was looking at the deserialization source code and I was curious why you took on such a heavy reliance on the TextReader abstraction rather than just dealing with the raw string. Maybe I'm mistaken, but it seems like the virtual method calls of StringReader and the sanity checks that it does incur a noticeable overhead. Maybe not under normal circumstances, but since you're already optimizing on the level of CPU cache optimization and branch prediction, I think it'd be fairly significant :) Especially since parsing an int requires two such virtual calls (Peek and Read) per digit. Wouldn't it be both more flexible as well as faster to just use the raw input string and indexing into it?

I've taken that approach in my JSV/JSON parser library (which isn't nearly as far along as yours) and most of the built in parsing functions take in a string, a start index and return the index at which they stopped parsing as an out parameter, like this double parser:

https://github.com/JulianR/Marlee/blob/master/Marlee/Common/Parsers/DoubleParser.cs

Deserialize<T> method throws NullReferenceException

I am trying to deserialize attached JSON using the following class definition:

    public class CongressContainer
    {
        public Action[] actions { get; set; }
        public Amendment[] amendments { get; set; }
        public Committee[] committees { get; set; }
        public Cosponsor[] cosponsors { get; set; }
        public Bill[] related_bills { get; set; }
        public Title[] titles { get; set; }

        public History history { get; set; }
        public Sponsor sponsor { get; set; }
        public Summary summary { get; set; }

        public string bill_id { get; set; }
        public string bill_type { get; set; }
        public bool by_request { get; set; }
        public string congress { get; set; }
        public string introduced_at { get; set; }
        public string number { get; set; }
        public string official_title { get; set; }
        public string popular_title { get; set; }
        public string short_title { get; set; }
        public string status { get; set; }
        public string status_at { get; set; }
        public string[] subjects { get; set; }
        public string subjects_top_term { get; set; }
        public string updated_at { get; set; }

        public class Action
        {
            public string acted_at { get; set; }
            public string[] committees { get; set; }
            public Reference[] references { get; set; }
            public string status { get; set; }
            public string text { get; set; }
            public string type { get; set; }
            public string[] bill_ids { get; set; }
            public string result { get; set; }
            public string roll { get; set; }
            public string vote_type { get; set; }
            public string how { get; set; }
            public string where { get; set; }
        }

        public class Reference
        {
            public string reference { get; set; }
            public string type { get; set; }
        }

        public class Amendment
        {
            public string amendment_id { get; set; }
            public string amendment_type { get; set; }
            public string chamber { get; set; }
            public string number { get; set; }
        }

        public class Committee
        {
            public string[] activity { get; set; }
            public string committee { get; set; }
            public string committee_id { get; set; }
            public string subcommittee { get; set; }
            public string subcommittee_id { get; set; }
        }

        public class Cosponsor
        {
            public string district { get; set; }
            public string name { get; set; }
            public string sponsored_at { get; set; }
            public string state { get; set; }
            public string thomas_id { get; set; }
            public string title { get; set; }
            public string withdrawn_at { get; set; }
        }

        public class History
        {
            public bool active { get; set; }
            public string active_at { get; set; }
            public bool awaiting_signature { get; set; }
            public bool enacted { get; set; }
            public string house_passage_result { get; set; }
            public string house_passage_result_at { get; set; }
            public bool vetoed { get; set; }
        }

        public class Bill
        {
            public string bill_id { get; set; }
            public string reason { get; set; }
            public string type { get; set; }
        }

        public class Sponsor
        {
            public string district { get; set; }
            public string name { get; set; }
            public string state { get; set; }
            public string thomas_id { get; set; }
            public string title { get; set; }
            public string type { get; set; }
        }

        public class Summary
        {
            public string @as { get; set; }
            public string date { get; set; }
            public string text { get; set; }
        }

        public class Title
        {
            public string @as { get; set; }
            public bool is_for_portion { get; set; }
            public string title { get; set; }
            public string type { get; set; }
        }
    }

Instead of deserialized object I receive the NullReferenceException with the following stacktrace:

   at System.Collections.Generic.List`1.ToArray()
   at _DynamicMethod3(TextReader )
   at Jil.JSON.Deserialize[T](TextReader reader, Options options) in c:\Users\kmontrose\Dropbox\jil\Jil\JSON.cs:line 579
   at Jil.JSON.Deserialize[T](TextReader reader, Options options) in c:\Users\kmontrose\Dropbox\jil\Jil\JSON.cs:line 594
   at Jil.JSON.Deserialize[T](String text, Options options) in c:\Users\kmontrose\Dropbox\jil\Jil\JSON.cs:line 618

I called JSON.Deserialize only with text and left default options. The JSON was created using the Jil.

{"by_request":false,"actions":[{"references":[],"committees":["HSIF"],"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"referral","text":"Referred to the Committee on Energy and Commerce, and in addition to the Committees on Ways and Means, and the Judiciary, for a period to be subsequently determined by the Speaker, in each case for consideration of such provisions as fall within the jurisdiction of the committee concerned.","status":"REFERRED","acted_at":"2014-02-06"},{"references":[],"committees":["HSIF"],"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"referral","text":"Referred to House Energy and Commerce","status":null,"acted_at":"2014-02-06"},{"references":[],"committees":["HSWM"],"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"referral","text":"Referred to House Ways and Means","status":null,"acted_at":"2014-02-06"},{"references":[],"committees":["HSJU"],"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"referral","text":"Referred to House Judiciary","status":null,"acted_at":"2014-02-06"},{"references":[],"committees":null,"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"referral","text":"Referred to the Subcommittee on Health.","status":null,"acted_at":"2014-02-07"},{"references":[{"type":null,"reference":"CR H1885-1886"}],"committees":null,"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"Sponsor introductory remarks on measure.","status":null,"acted_at":"2014-02-25"},{"references":[],"committees":["HSRU"],"bill_ids":["hres515-113","hr3189-113"],"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"Rules Committee Resolution H. Res. 515 Reported to House. The resolution provides for one hour of debate on H.R. 3189. The rule makes in order as original text for the purpose of amendment an amendment in the nature of a substitute recommended by the Committee on Natural Resources now printed in the bill and provides that it shall be considered as read. The rule provides for a closed rule for H.R. 4015 with one hour of debate on the bill.","status":null,"acted_at":"2014-03-12T19:24:00-04:00"},{"references":[],"committees":null,"bill_ids":["hres515-113"],"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"Rule H. Res. 515 passed House.","status":null,"acted_at":"2014-03-13T14:25:00-04:00"},{"references":[{"type":"consideration","reference":"CR H2439-2470"}],"committees":null,"bill_ids":["hres515-113"],"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"Considered under the provisions of rule H. Res. 515.","status":null,"acted_at":"2014-03-14T09:16:00-04:00"},{"references":[],"committees":["HSII"],"bill_ids":["hr3189-113"],"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"The resolution provides for one hour of debate on H.R. 3189. The rule makes in order as original text for the purpose of amendment an amendment in the nature of a substitute recommended by the Committee on Natural Resources now printed in the bill and provides that it shall be considered as read. The rule provides for a closed rule for H.R. 4015 with one hour of debate on the bill.","status":null,"acted_at":"2014-03-14T09:16:00-04:00"},{"references":[],"committees":null,"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"DEBATE - The House proceeded with one hour of debate on H.R. 4015.","status":null,"acted_at":"2014-03-14T09:17:00-04:00"},{"references":[],"committees":null,"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"DEBATE - The House continued with debate on H.R. 4015.","status":null,"acted_at":"2014-03-14T10:32:00-04:00"},{"references":[{"type":"consideration","reference":"CR H2468"}],"committees":null,"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"The previous question was ordered pursuant to the rule.","status":null,"acted_at":"2014-03-14T10:36:00-04:00"},{"references":[{"type":"consideration","reference":"CR H2468-1470"},{"type":"text","reference":"CR H2468"}],"committees":["HSWM"],"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"Mr. Loebsack moved to recommit with instructions to Ways and Means.","status":null,"acted_at":"2014-03-14T10:36:00-04:00"},{"references":[],"committees":null,"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"DEBATE - The House proceeded with 10 minutes of debate on the Loebsack motion to recommit with instructions, pending the reservation of a point of order. The instructions contained in the motion seek to require the bill to be reported back to the House with an amendment to add a section to the bill titled Prohibition on Medicare cuts or Vouchers. Subsequently, the reservation was withdrawn.","status":null,"acted_at":"2014-03-14T10:36:00-04:00"},{"references":[{"type":"consideration","reference":"CR H2469"}],"committees":null,"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"The previous question on the motion to recommit with instructions was ordered without objection.","status":null,"acted_at":"2014-03-14T10:43:00-04:00"},{"references":[],"committees":null,"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"On motion to recommit with instructions Failed by the Yeas and Nays: 191 - 226 (Roll no. 134).","status":null,"acted_at":"2014-03-14T11:08:00-04:00"},{"references":[{"type":"text","reference":"CR H2439-2457"}],"committees":null,"bill_ids":null,"where":"h","how":"roll","vote_type":"vote","roll":"135","result":"pass","type":"vote","text":"On passage Passed by the Yeas and Nays: 238 - 181 (Roll no. 135).","status":"PASS_OVER:HOUSE","acted_at":"2014-03-14T11:16:00-04:00"},{"references":[],"committees":null,"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"Motion to reconsider laid on the table Agreed to without objection.","status":null,"acted_at":"2014-03-14T11:16:00-04:00"},{"references":[],"committees":null,"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"referral","text":"Referred to the Subcommittee on the Constitution and Civil Justice.","status":null,"acted_at":"2014-03-20"},{"references":[],"committees":null,"bill_ids":null,"where":null,"how":null,"vote_type":null,"roll":null,"result":null,"type":"action","text":"Received in the Senate.","status":null,"acted_at":"2014-03-24"}],"amendments":[{"number":"598","chamber":"h","amendment_type":"hamdt","amendment_id":"hamdt598-113"}],"committees":[{"activity":["referral"],"subcommittee_id":null,"subcommittee":null,"committee_id":"HSIF","committee":"House Energy and Commerce"},{"activity":["referral"],"subcommittee_id":"14","subcommittee":"Subcommittee on Health","committee_id":"HSIF","committee":"House Energy and Commerce"},{"activity":["referral"],"subcommittee_id":null,"subcommittee":null,"committee_id":"HSWM","committee":"House Ways and Means"},{"activity":["referral"],"subcommittee_id":null,"subcommittee":null,"committee_id":"HSJU","committee":"House Judiciary"},{"activity":["referral"],"subcommittee_id":"10","subcommittee":"Subcommittee on Constitution and Civil Justice","committee_id":"HSJU","committee":"House Judiciary"}],"cosponsors":[{"withdrawn_at":null,"title":"Rep","thomas_id":"02090","state":"NV","sponsored_at":"2014-03-10","name":"Amodei, Mark E.","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02131","state":"KY","sponsored_at":"2014-03-05","name":"Barr, Andy","district":"6"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01780","state":"GA","sponsored_at":"2014-03-11","name":"Barrow, John","district":"12"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02027","state":"MI","sponsored_at":"2014-02-28","name":"Benishek, Dan","district":"1"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02102","state":"CA","sponsored_at":"2014-02-28","name":"Bera, Ami","district":"7"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01838","state":"FL","sponsored_at":"2014-03-10","name":"Bilirakis, Gus M.","district":"12"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01753","state":"UT","sponsored_at":"2014-03-06","name":"Bishop, Rob","district":"1"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00091","state":"GA","sponsored_at":"2014-03-05","name":"Bishop, Sanford D., Jr.","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02063","state":"TN","sponsored_at":"2014-03-10","name":"Black, Diane","district":"6"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01748","state":"TN","sponsored_at":"2014-03-05","name":"Blackburn, Marsha","district":"7"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00099","state":"OR","sponsored_at":"2014-02-26","name":"Blumenauer, Earl","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01723","state":"GU","sponsored_at":"2014-02-26","name":"Bordallo, Madeleine Z.","district":null},{"withdrawn_at":null,"title":"Rep","thomas_id":"01787","state":"LA","sponsored_at":"2014-02-06","name":"Boustany, Charles W., Jr.","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01468","state":"TX","sponsored_at":"2014-02-06","name":"Brady, Kevin","district":"8"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01840","state":"FL","sponsored_at":"2014-03-05","name":"Buchanan, Vern","district":"16"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02018","state":"IN","sponsored_at":"2014-02-26","name":"Bucshon, Larry","district":"8"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00166","state":"MI","sponsored_at":"2014-02-06","name":"Camp, Dave","district":"4"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01676","state":"WV","sponsored_at":"2014-03-10","name":"Capito, Shelley Moore","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00186","state":"OH","sponsored_at":"2014-03-11","name":"Chabot, Steve","district":"1"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01912","state":"CO","sponsored_at":"2014-03-06","name":"Coffman, Mike","district":"6"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01878","state":"TN","sponsored_at":"2014-03-06","name":"Cohen, Steve","district":"9"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02144","state":"ND","sponsored_at":"2014-03-10","name":"Cramer, Kevin","district":null},{"withdrawn_at":null,"title":"Rep","thomas_id":"01989","state":"AR","sponsored_at":"2014-03-11","name":"Crawford, Eric A. \"Rick\"","district":"1"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01807","state":"TX","sponsored_at":"2014-02-28","name":"Cuellar, Henry","district":"28"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01477","state":"IL","sponsored_at":"2014-03-06","name":"Davis, Danny K.","district":"7"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00279","state":"OR","sponsored_at":"2014-03-10","name":"DeFazio, Peter A.","district":"4"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01479","state":"CO","sponsored_at":"2014-03-05","name":"DeGette, Diana","district":"1"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01799","state":"PA","sponsored_at":"2014-03-05","name":"Dent, Charles W.","district":"15"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00299","state":"MI","sponsored_at":"2014-03-05","name":"Dingell, John D.","district":"12"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01894","state":"MD","sponsored_at":"2014-03-05","name":"Edwards, Donna F.","district":"4"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02036","state":"NC","sponsored_at":"2014-03-10","name":"Ellmers, Renee L.","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00355","state":"CA","sponsored_at":"2014-03-06","name":"Eshoo, Anna G.","district":"18"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00368","state":"CA","sponsored_at":"2014-02-26","name":"Farr, Sam","district":"20"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01797","state":"PA","sponsored_at":"2014-02-26","name":"Fitzpatrick, Michael G.","district":"8"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02065","state":"TX","sponsored_at":"2014-02-26","name":"Flores, Bill","district":"17"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01793","state":"NE","sponsored_at":"2014-03-11","name":"Fortenberry, Jeff","district":"1"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02049","state":"OH","sponsored_at":"2014-03-06","name":"Gibbs, Bob","district":"7"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01720","state":"GA","sponsored_at":"2014-03-06","name":"Gingrey, Phil","district":"11"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01656","state":"MO","sponsored_at":"2014-03-10","name":"Graves, Sam","district":"6"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00462","state":"TX","sponsored_at":"2014-02-26","name":"Green, Gene","district":"29"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01990","state":"AR","sponsored_at":"2014-03-10","name":"Griffin, Tim","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01708","state":"AZ","sponsored_at":"2014-03-11","name":"Grijalva, Raul M.","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02041","state":"NY","sponsored_at":"2014-03-10","name":"Grimm, Michael G.","district":"11"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01922","state":"KY","sponsored_at":"2014-03-05","name":"Guthrie, Brett","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00484","state":"TX","sponsored_at":"2014-02-28","name":"Hall, Ralph M.","district":"4"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02044","state":"NY","sponsored_at":"2014-03-10","name":"Hanna, Richard L.","district":"22"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01933","state":"MS","sponsored_at":"2014-03-06","name":"Harper, Gregg","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02170","state":"WA","sponsored_at":"2014-03-05","name":"Heck, Denny","district":"10"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02040","state":"NV","sponsored_at":"2014-03-05","name":"Heck, Joseph J.","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01634","state":"CA","sponsored_at":"2014-03-06","name":"Honda, Michael M.","district":"17"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02147","state":"NV","sponsored_at":"2014-03-06","name":"Horsford, Steven A.","district":"4"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02140","state":"NC","sponsored_at":"2014-03-05","name":"Hudson, Richard","district":"8"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02101","state":"CA","sponsored_at":"2014-03-05","name":"Huffman, Jared","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01663","state":"NY","sponsored_at":"2014-03-11","name":"Israel, Steve","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02046","state":"OH","sponsored_at":"2014-03-05","name":"Johnson, Bill","district":"6"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00603","state":"TX","sponsored_at":"2014-03-11","name":"Johnson, Sam","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02051","state":"PA","sponsored_at":"2014-03-12","name":"Kelly, Mike","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01498","state":"WI","sponsored_at":"2014-03-06","name":"Kind, Ron","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01936","state":"NJ","sponsored_at":"2014-03-10","name":"Lance, Leonard","district":"7"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00666","state":"IA","sponsored_at":"2014-03-06","name":"Latham, Tom","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01885","state":"OH","sponsored_at":"2014-03-10","name":"Latta, Robert E.","district":"5"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00683","state":"MI","sponsored_at":"2014-02-06","name":"Levin, Sander M.","district":"9"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00688","state":"GA","sponsored_at":"2014-03-10","name":"Lewis, John","district":"5"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00699","state":"NJ","sponsored_at":"2014-03-12","name":"LoBiondo, Frank A.","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02033","state":"MO","sponsored_at":"2014-03-05","name":"Long, Billy","district":"7"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01943","state":"NY","sponsored_at":"2014-03-06","name":"Maffei, Daniel B.","district":"24"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02150","state":"NY","sponsored_at":"2014-03-10","name":"Maloney, Sean Patrick","district":"18"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01671","state":"UT","sponsored_at":"2014-03-05","name":"Matheson, Jim","district":"4"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01814","state":"CA","sponsored_at":"2014-03-05","name":"Matsui, Doris O.","district":"6"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01804","state":"TX","sponsored_at":"2014-03-12","name":"McCaul, Michael T.","district":"10"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00766","state":"WA","sponsored_at":"2014-02-06","name":"McDermott, Jim","district":"7"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01792","state":"NC","sponsored_at":"2014-03-11","name":"McHenry, Patrick T.","district":"10"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02074","state":"WV","sponsored_at":"2014-02-18","name":"McKinley, David B.","district":"1"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01731","state":"MI","sponsored_at":"2014-03-12","name":"Miller, Candice S.","district":"10"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01685","state":"FL","sponsored_at":"2014-03-06","name":"Miller, Jeff","district":"1"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01744","state":"PA","sponsored_at":"2014-02-28","name":"Murphy, Tim","district":"18"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02108","state":"CA","sponsored_at":"2014-03-05","name":"Negrete McLeod, Gloria","district":"35"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00868","state":"DC","sponsored_at":"2014-03-10","name":"Norton, Eleanor Holmes","district":null},{"withdrawn_at":null,"title":"Rep","thomas_id":"01710","state":"CA","sponsored_at":"2014-02-28","name":"Nunes, Devin","district":"22"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02162","state":"TX","sponsored_at":"2014-02-26","name":"O'Rourke, Beto","district":"16"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00887","state":"NJ","sponsored_at":"2014-02-06","name":"Pallone, Frank, Jr.","district":"6"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01930","state":"MN","sponsored_at":"2014-03-06","name":"Paulsen, Erik","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01738","state":"NM","sponsored_at":"2014-02-18","name":"Pearce, Stevan","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01929","state":"MI","sponsored_at":"2014-03-05","name":"Peters, Gary C.","district":"14"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00912","state":"WI","sponsored_at":"2014-03-05","name":"Petri, Thomas E.","district":"6"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01514","state":"PA","sponsored_at":"2014-02-06","name":"Pitts, Joseph R.","district":"16"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02022","state":"KS","sponsored_at":"2014-03-10","name":"Pompeo, Mike","district":"4"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01778","state":"GA","sponsored_at":"2014-03-05","name":"Price, Tom","district":"6"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00940","state":"WV","sponsored_at":"2014-03-06","name":"Rahall, Nick J., II","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"00944","state":"NY","sponsored_at":"2014-03-05","name":"Rangel, Charles B.","district":"13"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01982","state":"NY","sponsored_at":"2014-03-06","name":"Reed, Tom","district":"23"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02068","state":"VA","sponsored_at":"2014-03-11","name":"Rigell, E. Scott","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01954","state":"TN","sponsored_at":"2014-02-28","name":"Roe, David P.","district":"1"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01651","state":"MI","sponsored_at":"2014-02-26","name":"Rogers, Mike J.","district":"8"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01916","state":"FL","sponsored_at":"2014-03-11","name":"Rooney, Thomas J.","district":"17"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02109","state":"CA","sponsored_at":"2014-02-28","name":"Ruiz, Raul","district":"36"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01728","state":"MD","sponsored_at":"2014-03-05","name":"Ruppersberger, C. A. Dutch","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01003","state":"IL","sponsored_at":"2014-03-10","name":"Rush, Bobby L.","district":"1"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01962","state":"MP","sponsored_at":"2014-03-05","name":"Sablan, Gregorio Kilili Camacho","district":null},{"withdrawn_at":null,"title":"Rep","thomas_id":"01950","state":"OR","sponsored_at":"2014-03-05","name":"Schrader, Kurt","district":"5"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01798","state":"PA","sponsored_at":"2014-02-26","name":"Schwartz, Allyson Y.","district":"13"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01722","state":"GA","sponsored_at":"2014-03-05","name":"Scott, David","district":"13"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01525","state":"TX","sponsored_at":"2014-02-26","name":"Sessions, Pete","district":"32"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01681","state":"PA","sponsored_at":"2014-03-10","name":"Shuster, Bill","district":"9"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01075","state":"TX","sponsored_at":"2014-03-10","name":"Smith, Lamar","district":"21"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01890","state":"CA","sponsored_at":"2014-03-06","name":"Speier, Jackie","district":"14"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02047","state":"OH","sponsored_at":"2014-03-05","name":"Stivers, Steve","district":"15"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02110","state":"CA","sponsored_at":"2014-03-06","name":"Takano, Mark","district":"41"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01566","state":"NE","sponsored_at":"2014-02-26","name":"Terry, Lee","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01593","state":"CA","sponsored_at":"2014-03-05","name":"Thompson, Mike","district":"5"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01155","state":"TX","sponsored_at":"2014-02-28","name":"Thornberry, Mac","district":"13"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01664","state":"OH","sponsored_at":"2014-03-05","name":"Tiberi, Patrick J.","district":"12"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01942","state":"NY","sponsored_at":"2014-03-06","name":"Tonko, Paul","district":"20"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01177","state":"MI","sponsored_at":"2014-02-06","name":"Upton, Fred","district":"6"},{"withdrawn_at":null,"title":"Rep","thomas_id":"02128","state":"IN","sponsored_at":"2014-03-10","name":"Walorski, Jackie","district":"2"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01209","state":"CA","sponsored_at":"2014-02-06","name":"Waxman, Henry A.","district":"33"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01779","state":"GA","sponsored_at":"2014-03-05","name":"Westmoreland, Lynn A.","district":"3"},{"withdrawn_at":null,"title":"Rep","thomas_id":"01222","state":"KY","sponsored_at":"2014-03-05","name":"Whitfield, Ed","district":"1"}],"related_bills":[{"type":"bill","reason":"rule","bill_id":"hres515-113"},{"type":"bill","reason":"related","bill_id":"hr2810-113"},{"type":"bill","reason":"related","bill_id":"hr4209-113"},{"type":"bill","reason":"related","bill_id":"hr4418-113"},{"type":"bill","reason":"related","bill_id":"hr4750-113"},{"type":"bill","reason":"related","bill_id":"s1769-113"},{"type":"bill","reason":"related","bill_id":"s1871-113"},{"type":"bill","reason":"identical","bill_id":"s2000-113"},{"type":"bill","reason":"related","bill_id":"s2110-113"},{"type":"bill","reason":"related","bill_id":"s2122-113"},{"type":"bill","reason":"related","bill_id":"s2157-113"}],"titles":[{"is_for_portion":false,"type":"short","title":"SGR Repeal and Medicare Provider Payment Modernization Act of 2014","as":"introduced"},{"is_for_portion":false,"type":"short","title":"SGR Repeal and Medicare Provider Payment Modernization Act of 2014","as":"passed house"},{"is_for_portion":false,"type":"official","title":"To amend title XVIII of the Social Security Act to repeal the Medicare sustainable growth rate and improve Medicare payments for physicians and other professionals, and for other purposes.","as":"introduced"}],"history":{"vetoed":false,"enacted":false,"awaiting_signature":false,"active":true,"house_passage_result_at":"2014-03-14T11:16:00-04:00","house_passage_result":"pass","active_at":"2014-03-12T19:24:00-04:00"},"sponsor":{"type":"person","title":"Rep","thomas_id":"01751","state":"TX","name":"Burgess, Michael C.","district":"26"},"summary":{"text":"SGR Repeal and Medicare Provider Payment Modernization Act of 2014 - (Sec. 2) Amends part B (Supplementary Medical Insurance) of title XVIII (Medicare) of the Social Security Act (SSA) to: (1) end with 2013 the current formula for an update to the single conversion factor in the formula for payment for physicians' services, (2) end and remove sustainable growth rate (SGR) methodology from the determination of such annual conversion factors, (3) prescribe an update to the single conversion factor for 2014-2018 of 0.5%, (4) freeze the update to the single conversion factor at 0.00% for 2019-2023, and (5) establish for 2024 and subsequent years an update of 1% for health professionals participating in alternative payment models (APMs) and an update of 0.5% for all other health professionals.\n\nDirects the Medicare Payment Advisory Commission (MEDPAC) to report to Congress on the relationship between: (1) physician and other health professional utilization and expenditures (and their rates of increase) of items and services for which Medicare payment is made, and (2) total utilization and expenditures (and their rate of increase) under Medicare parts A (Hospital Insurance), B, and D (Voluntary Prescription Drug Benefit Program).\n\nDirects MEDPAC to report to Congress on: (1) the payment update for professional services applied for 2014-2018; (2) the effect of that update on the efficiency, economy, and quality of care; (3) the update's effect on ensuring a sufficient number of providers to maintain access to care by Medicare beneficiaries; and (4) recommendations for any future payment updates to ensure adequate access to care is maintained for such beneficiaries.\n\nDirects the Secretary of Health and Human Services (HHS) to establish a merit-based incentive payment system (MIPS) by consolidating (with certain revisions) the existing: (1) electronic health record (EHR) meaningful use incentive program, (2) quality reporting program, and (3) value-based payment program.\n\n Applies the MIPS program to payments for items and services furnished on or after January 1, 2018.\n\nRequires MIPS-eligible professionals (excluding most APM participants) to receive annual payment increases or decreases based on their performance.\n\nDefines MIPS-eligible professional as: (1) a physician, a physician assistant, nurse practitioner, clinical nurse specialist, and a certified registered nurse anesthetist during the MIPS program's first two years, and (2) also other eligible professionals specified by the Secretary for succeeding years.\n\n Excludes from treatment as a MIPS eligible professional any eligible professional who is: (1) a qualifying APM participant; (2) a partial qualifying APM participant for the most recent period for which data are available and who, for the performance period with respect to that year, does not report on applicable measures and activities a MIPS professional is required to report; or (3) does not exceed, for that performance period, a specified low-volume threshold measurement.\n\nQualifies for MIPS incentive payments a partial qualifying APM participant who reports on applicable measures and activities a MIPS professional is required to report.\n\nPrescribes requirements for: (1) application of the MIPS program to group practices; and (2) measures and activities under the performance categories of quality, resource use, clinical practice improvement, and meaningful use of EHR technology.\n\nRequires the Secretary, on an ongoing basis, to: (1) estimate how an individual's health status and other risk factors affect quality and resource use outcome measures; (2) incorporate information from quality and resource use outcome measurements (including care episode and patient condition groups) into the MIPS; and (3) account for identified factors with an effect on those measures when determining payment adjustments, composite performance scores, scores for performance categories, or scores for measures or activities under the MIPS. Requires the Secretary to: (1) establish performance standards for the MIPS program, taking into account historical performance standards, improvement rates, and the opportunity for continued improvement; and (2) develop a methodology for assessing the total performance of each MIPS eligible professional according to such standards with respect to applicable measures and activities for each performance category, leading to a composite performance score for each professional for each performance period.\n\nDirects the Secretary to specify a MIPS adjustment factor for each MIPS eligible professional for a year according to a formula taking into account composite performance scores above or below a performance threshold, including those at or above an additional performance threshold (for exceptional performance).\n\nMakes appropriations for 2018-2023 from the Federal Supplementary Medical Insurance Trust Fund for MIPS payments resulting from additional MIPS adjustment factors.\n\nPrescribes a formula for the calculation of MIPS program incentive payments, beginning with 2018, subject to criteria for budget neutrality as well as a process for review of the calculation of an individual professional's MIPS program incentive payment adjustment factor for a year.\n\nDirects the Secretary to make available on the Physician Compare website of the Centers for Medicare & Medicaid Services (CMS) certain information, including information regarding the performance of MIPS-eligible professionals.\n\nDirects the Secretary to enter into contracts or agreements with appropriate entities (such as quality improvement organizations, regional extension centers, or regional health collaboratives) to offer guidance and assistance about performance categories or transition to an APM to MIPS-eligible professionals in practices of 15 or fewer professionals (with priority given to practices located in rural areas, health professional shortage areas, medically underserved areas, and practices with low composite performance scores).\n\nRequires the Secretary to make available to each MIPS eligible professional timely (such as quarterly) confidential feedback and other information to improve performance.\n\nRequires the Comptroller General (GAO) to: (1) evaluate the MIPS program; and (2) report on the similarities and differences in the use of quality measures under the original Medicare fee-for-service program, the Medicare Advantage program under Medicare part C (Medicare+Choice), selected state medical assistance programs under SSA title XIX (Medicaid), and private payer arrangements, and make recommendations on how to reduce the administrative burden involved in applying such quality measures.\n\nDirects GAO to examine: (1) whether entities that pool financial risk for physician services (such as independent risk managers) can play a role in supporting physician practices in assuming financial risk for treatment of patients; and (2) the transition to an APM of professionals in rural areas, health professional shortage areas, or medically underserved areas.\n\nEstablishes the Payment Model Technical Advisory Committee to make recommendations to the Secretary on physician-focused payment models.\n\nPrescribes incentive payments for participation in eligible APMs between 2018 and 2023, consisting of an additional 5% of the current-year payment amount for the covered professional services for the preceding year.\n\nProhibits any construction of this Act to preclude an APM or a qualifying APM participant from furnishing a telehealth service for which Medicare payment is not made.\n\nDirects the Secretary to study: (1) the feasibility of integrating APMs in the Medicare Advantage payment system, (2) the applicability of federal fraud prevention laws to items and services furnished under Medicare for which payment is made under an APM, (2) aspects of such APMs that are vulnerable to fraudulent activity, and (3) the implication of waivers to such laws granted in support of such APMs.\n\nRequires the Secretary to study: (1) the effect of individuals' socioeconomic status on quality and resource use outcome measures for individuals under Medicare; and (2) the impact of certain risk factors, race, health literacy, limited English proficiency (LEP), and patient activation on quality and resource use outcome measures under Medicare.\n\nDirects the Secretary, taking account of such studies, to: (1) estimate how an individual's health status and other risk factors affect quality and resource use outcome measures and, as feasible, to incorporate information from quality and resource use outcome measurement into the eligible professional MIPS incentive program; and (2) account for other identified factors with an effect on quality and resource use outcome measures when determining payment adjustments under the MIPS incentive program.\n\nDirects the Secretary to develop and report to Congress on a strategic plan for collecting or otherwise assessing data on race and ethnicity for purposes of carrying out the eligible professional MIPS incentive program.\n\nDirects the Secretary to take certain steps, including development of care episode and patient condition groups as well as proposed classification codes, in order to involve the physician, practitioner, and other stakeholder communities in enhancing the infrastructure for resource use measurement for MIPS, APM, and other purposes.\n\n Prohibits the Secretary from contracting with an entity, or an entity from subcontracting with another entity, if either the contracting or the subcontracting entity currently makes recommendations to the Secretary on relative values for physicians' services under the fee schedule. (Sec. 3) Directs the Secretary to develop and post on the Internet website of the Centers for Medicare and Medicaid Services (CMS) a draft plan as well as an operational plan, taking stakeholder comments on the draft plan into account, for the development of quality measures to assess professionals.\n\nDirects the Secretary to enter into contracts or other arrangements with entities, including those organizations with quality measure development expertise, for the purpose of developing, improving, updating, or expanding such quality measures.\n\nRequires the Secretary to transfer $15 million from the Federal Supplemental Medical Insurance Trust Fund to the CMS Program Management Account for each of FY2014-2018.\n\n(Sec. 4) Requires the Secretary to: (1) establish one or more Healthcare Common Procedure Coding System (HCPCS) codes for chronic care management services for patients with chronic care needs, (2) make payments for any such services furnished by an applicable provider, and (3) conduct an education and outreach campaign to inform professionals who furnish items and services under Medicare part B and Medicare part B enrollees of the benefits of chronic care management services.\n\n(Sec. 5) Authorizes the Secretary to: (1) collect or obtain information from any eligible professional or any other source on the resources directly or indirectly related to furnishing services paid for under the Medicare fee schedule, and (2) use such information to determine relative values for those services.\n\nAuthorizes the Secretary to establish or adjust practice expense relative values using cost, charge, or other data from suppliers or service providers, including any such collected or obtained information.\n\nExpands the list of codes the Secretary must examine to identify services that may be misvalued, including codes: (1) that account for the majority of spending under the physician fee schedule, (2) that have experienced a substantial change in the hospital length of stay or procedure time, (3) for which there is a significant difference in payment for the same service between different sites of service, (4) with high intra-service work per unit of time, (5) with high practice expense relative value units (RVUs), and (6) with high cost supplies.\n\nSets at 0.5% of the estimated amount of fee schedule expenditures in 2015-2018 the annual target (estimated net reduction in expenditures under the fee schedule) with respect to relative value adjustments for misvalued services.\n\nDeclares that, for fee schedules beginning with 2015, if the RVUs for a service for a year would otherwise be decreased by an estimated 20% or more as compared to the total RVUs for the previous year, the applicable adjustments in work, practice expense, and malpractice RVUs must be phased-in over a two-year period.\n\nDirects GAO to study the processes used by the Relative Value Scale Update Committee (RUC) (of the American Medical Association) to make recommendations to the Secretary regarding relative values for specific services.\n\nRequires the use on or after January 1, 2017, of metropolitan statistical areas (MSAs) as fee schedule areas in California, with all areas not included in an MSA to be treated as a single rest-of-state fee schedule area.\n\nPrescribes a formula for the geographic index values applied to the physicians fee schedule for MSAs previously in the rest-of-payment locality or in locality 3.\n\n Directs the Secretary to make publicly available the information used to establish the multiple procedure payment reduction policy to the professional component of imaging services in a specified final rule under the physicians fee schedule.\n\n(Sec. 6) Directs the Secretary to: (1) establish a program to promote the use of appropriate use criteria for certain advanced diagnostic imaging services furnished by ordering and furnishing professionals, and (2) specify applicable appropriate use criteria for imaging services from among appropriate use criteria developed or endorsed by national professional medical specialty societies or other entities.\n\nDirects the Secretary to: (1) determine, on a periodic basis, outlier ordering professionals; and (2) apply prior authorization for applicable imaging services ordered by an outlier ordering professional.\n\nProhibits the construction of these requirements as authorizing the Secretary to develop or initiate the development of clinical practice guidelines or appropriate use criteria.\n\n(Sec. 7) Requires the Secretary to make publicly available on the CMS Physician Compare website specified information with respect to eligible professionals.\n\n(Sec. 8) Allows a qualified entity, beginning July 1, 2015, to use Medicare claims data combined with data from sources other than claims data, as well as information derived from a specified performance evaluation of service providers and suppliers, to: (1) conduct additional appropriate non-public analyses; and (2) provide or sell them (subject to certain conditions) to physicians, other professionals, providers, medical societies, and hospital associations and certain other entities for non-public use. Prohibits any use of an analysis or data for marketing purposes.\n\nExpands the kinds (including standardized extracts) and uses of claims data available to qualified entities for quality improvement activities.\n\nLimits the provision or sale of such analyses to: (1) an employer solely for the purposes of providing health insurance to its employees and retirees, and (2) a health insurance issuer only if the issuer is providing the qualified entity offering the analyses with Medicare claims data combined with data from sources other than claims data.\n\nRequires a qualified entity and an authorized user that is a service provider, supplier, or medical society or hospital association to enter into an agreement regarding the use of any data that the qualified entity is providing to or selling the user, including privacy and data security requirements and any prohibitions on using such data to link to other individually identifiable sources of information. Requires the Secretary to: (1) impose a specified administrative assessment for any breach of such an agreement by a qualified entity, and (2) deposit assessment amounts into the Federal Supplementary Medical Insurance Trust Fund. Prohibits authorized users from redisclosing (except for performance improvement and care coordination activities) or making public any analysis, data, or analysis using data they have obtained or bought. Requires any fees charged for making standardized extracts of claims data available to qualified entities to be deposited into the CMS Program Management Account (currently, into the Federal Supplementary Medical Insurance Trust Fund). Directs the Secretary to provide Medicare claims data, and if appropriate also data under Medicaid and SSA title XXI (Children's Health Insurance Program) (CHIP), to requesting qualified clinical data registries in order to link such data with clinical outcomes data and perform risk-adjusted, scientifically valid analyses and research to support quality improvement or patient safety. Limits fees charged for such data to the cost of providing it, and requires their deposit into the CMS Program Management Account.\n\nRequires any fees charged for making standardized extracts of claims data available to qualified entities to be deposited into the CMS Program Management Account (currently, into the Federal Supplementary Medical Insurance Trust Fund).\n\n(Sec. 9) Permits continuing automatic extensions of a Medicare physician and practitioner election to opt-out of the Medicare physician payment system into private contracts.\n\nDirects the Secretary to make publicly available through an appropriate publicly accessible website information on the number and characteristics of opt-out physicians and practitioners.\n\nDirects the Secretary to make recommendations to Congress to amend existing fraud and abuse law to permit gainsharing or similar arrangements between physicians and hospitals that improve care while reducing waste and increasing efficiency.\n\nDeclares it a national objective to achieve widespread and nationwide exchange of health information through interoperable certified EHR technology by December 31, 2017, as a consequence of a significant federal investment in the implementation of health information technology through the Medicare and Medicaid EHR incentive programs.\n\nDirects the Secretary to study the feasibility of establishing mechanisms to compare certified EHR technology products.\n\n(Sec. 10) Amends the Internal Revenue Code to delay until January 1, 2019, implementation of the penalty for failure to comply with the individual health insurance mandate under the Patient Protection and Affordable Care Act to maintain minimum essential health care coverage.","date":"2014-03-14","as":"Passed House amended"},"subjects":["Advisory bodies","Congressional oversight","Fraud offenses and financial crimes","Government information and archives","Government studies and investigations","Government trust funds","Health","Health care coverage and access","Health care quality","Health information and medical records","Health personnel","Hospital care","Medicare","Minority health","Performance measurement","Rural conditions and development"],"updated_at":"2014-09-13T06:55:49-04:00","subjects_top_term":"Health","status_at":"2014-03-14T11:16:00-04:00","status":"PASS_OVER:HOUSE","short_title":"SGR Repeal and Medicare Provider Payment Modernization Act of 2014","popular_title":null,"official_title":"To amend title XVIII of the Social Security Act to repeal the Medicare sustainable growth rate and improve Medicare payments for physicians and other professionals, and for other purposes.","number":"4015","introduced_at":"2014-02-06","congress":"113","bill_type":"hr","bill_id":"hr4015-113"}

Improved IsWhiteSpace(int c)

static bool IsWhiteSpace(int c)
        {
            // per http://www.ietf.org/rfc/rfc4627.txt
            // insignificant whitespace in JSON is defined as 
            //  \u0020  - space
            //  \u0009  - tab
            //  \u000A  - new line
            //  \u000D  - carriage return

            return
                c == 0x20 ||
                c == 0x09 ||
                c == 0x0A ||
                c == 0x0D;
        }

Can be written as?

static bool IsWhiteSpace(int c)
        {
            // per http://www.ietf.org/rfc/rfc4627.txt
            // insignificant whitespace in JSON is defined as 
            //  \u0020  - space
            //  \u0009  - tab
            //  \u000A  - new line
            //  \u000D  - carriage return

            return
                c < 0x21 && (
                c == 0x20 ||
                c == 0x09 ||
                c == 0x0A ||
                c == 0x0D);
        }

Own attributes (separate from DataMamber)

I'm facing such problem: I want to replace Json.NET with more effective serializer. Unfortunnaly some my classes are DataContracts and I use DataMember attributes for XmlSerialization and JsonProperty attributes for JSON... The names ARE different and I don't want to break message contracts... So how about optional attributes?

Deserialization throws 'Input string was not in a correct format.'

I am going to deserialize the following JSON

{
  "query": {
    "params": {
      "accuracy": 0,
      "autocomplete": false,
      "granularity": "neighborhood",
      "query": "Toronto",
      "trim_place": false
    },
    "type": "search",
    "url": "https://api.twitter.com/1.1/geo/search.json?accuracy=0&query=Toronto&granularity=neighborhood&autocomplete=false&trim_place=false"
  },
  "result": {
    "places": [
      {
        "attributes": {},
        "bounding_box": {
          "coordinates": [
            [
              [
                -96.647415,
                44.566715
              ],
              [
                -96.630435,
                44.566715
              ],
              [
                -96.630435,
                44.578118
              ],
              [
                -96.647415,
                44.578118
              ]
            ]
          ],
          "type": "Polygon"
        },
        "contained_within": [
          {
            "attributes": {},
            "bounding_box": {
              "coordinates": [
                [
                  [
                    -104.057739,
                    42.479686
                  ],
                  [
                    -96.436472,
                    42.479686
                  ],
                  [
                    -96.436472,
                    45.945716
                  ],
                  [
                    -104.057739,
                    45.945716
                  ]
                ]
              ],
              "type": "Polygon"
            },
            "country": "United States",
            "country_code": "US",
            "full_name": "South Dakota, US",
            "id": "d06e595eb3733f42",
            "name": "South Dakota",
            "place_type": "admin",
            "url": "https://api.twitter.com/1.1/geo/id/d06e595eb3733f42.json"
          }
        ],
        "country": "United States",
        "country_code": "US",
        "full_name": "Toronto, SD",
        "id": "3e8542a1e9f82870",
        "name": "Toronto",
        "place_type": "city",
        "url": "https://api.twitter.com/1.1/geo/id/3e8542a1e9f82870.json"
      },
      {
        "attributes": {},
        "bounding_box": {
          "coordinates": [
            [
              [
                -80.622815,
                40.436469
              ],
              [
                -80.596567,
                40.436469
              ],
              [
                -80.596567,
                40.482566
              ],
              [
                -80.622815,
                40.482566
              ]
            ]
          ],
          "type": "Polygon"
        },
        "contained_within": [
          {
            "attributes": {},
            "bounding_box": {
              "coordinates": [
                [
                  [
                    -84.820305,
                    38.403423
                  ],
                  [
                    -80.518454,
                    38.403423
                  ],
                  [
                    -80.518454,
                    42.327132
                  ],
                  [
                    -84.820305,
                    42.327132
                  ]
                ]
              ],
              "type": "Polygon"
            },
            "country": "United States",
            "country_code": "US",
            "full_name": "Ohio, US",
            "id": "de599025180e2ee7",
            "name": "Ohio",
            "place_type": "admin",
            "url": "https://api.twitter.com/1.1/geo/id/de599025180e2ee7.json"
          }
        ],
        "country": "United States",
        "country_code": "US",
        "full_name": "Toronto, OH",
        "id": "53d949149e8cd438",
        "name": "Toronto",
        "place_type": "city",
        "url": "https://api.twitter.com/1.1/geo/id/53d949149e8cd438.json"
      },
      {
        "attributes": {},
        "bounding_box": {
          "coordinates": [
            [
              [
                -79.639128,
                43.403221
              ],
              [
                -78.90582,
                43.403221
              ],
              [
                -78.90582,
                43.855466
              ],
              [
                -79.639128,
                43.855466
              ]
            ]
          ],
          "type": "Polygon"
        },
        "contained_within": [
          {
            "attributes": {},
            "bounding_box": {
              "coordinates": [
                [
                  [
                    -95.155919,
                    41.676329
                  ],
                  [
                    -74.339383,
                    41.676329
                  ],
                  [
                    -74.339383,
                    56.852398
                  ],
                  [
                    -95.155919,
                    56.852398
                  ]
                ]
              ],
              "type": "Polygon"
            },
            "country": "Canada",
            "country_code": "CA",
            "full_name": "Ontario, Canada",
            "id": "89b2eb8b2b9847f7",
            "name": "Ontario",
            "place_type": "admin",
            "url": "https://api.twitter.com/1.1/geo/id/89b2eb8b2b9847f7.json"
          }
        ],
        "country": "Canada",
        "country_code": "CA",
        "full_name": "Toronto, Ontario",
        "id": "8f9664a8ccd89e5c",
        "name": "Toronto",
        "place_type": "city",
        "url": "https://api.twitter.com/1.1/geo/id/8f9664a8ccd89e5c.json"
      },
      {
        "attributes": {},
        "bounding_box": {
          "coordinates": [
            [
              [
                -90.867234,
                41.898723
              ],
              [
                -90.859467,
                41.898723
              ],
              [
                -90.859467,
                41.906811
              ],
              [
                -90.867234,
                41.906811
              ]
            ]
          ],
          "type": "Polygon"
        },
        "contained_within": [
          {
            "attributes": {},
            "bounding_box": {
              "coordinates": [
                [
                  [
                    -96.639485,
                    40.375437
                  ],
                  [
                    -90.140061,
                    40.375437
                  ],
                  [
                    -90.140061,
                    43.501196
                  ],
                  [
                    -96.639485,
                    43.501196
                  ]
                ]
              ],
              "type": "Polygon"
            },
            "country": "United States",
            "country_code": "US",
            "full_name": "Iowa, US",
            "id": "3cd4c18d3615bbc9",
            "name": "Iowa",
            "place_type": "admin",
            "url": "https://api.twitter.com/1.1/geo/id/3cd4c18d3615bbc9.json"
          }
        ],
        "country": "United States",
        "country_code": "US",
        "full_name": "Toronto, IA",
        "id": "173d6f9c3249b4fd",
        "name": "Toronto",
        "place_type": "city",
        "url": "https://api.twitter.com/1.1/geo/id/173d6f9c3249b4fd.json"
      },
      {
        "attributes": {},
        "bounding_box": {
          "coordinates": [
            [
              [
                -95.956873,
                37.792724
              ],
              [
                -95.941288,
                37.792724
              ],
              [
                -95.941288,
                37.803752
              ],
              [
                -95.956873,
                37.803752
              ]
            ]
          ],
          "type": "Polygon"
        },
        "contained_within": [
          {
            "attributes": {},
            "bounding_box": {
              "coordinates": [
                [
                  [
                    -102.051769,
                    36.993016
                  ],
                  [
                    -94.588387,
                    36.993016
                  ],
                  [
                    -94.588387,
                    40.003166
                  ],
                  [
                    -102.051769,
                    40.003166
                  ]
                ]
              ],
              "type": "Polygon"
            },
            "country": "United States",
            "country_code": "US",
            "full_name": "Kansas, US",
            "id": "27c45d804c777999",
            "name": "Kansas",
            "place_type": "admin",
            "url": "https://api.twitter.com/1.1/geo/id/27c45d804c777999.json"
          }
        ],
        "country": "United States",
        "country_code": "US",
        "full_name": "Toronto, KS",
        "id": "b90e4628bff4ad82",
        "name": "Toronto",
        "place_type": "city",
        "url": "https://api.twitter.com/1.1/geo/id/b90e4628bff4ad82.json"
      }
    ]
  }
}

into Twitter class using the following class definition

    public class Twitter
    {
        public Query query { get; set; }
        public Result result { get; set; }

        public class Query
        {
            public Parameters @params { get; set; }
            public string type { get; set; }
            public string url { get; set; }
        }

        public class Parameters
        {
            public int accuracy { get; set; }
            public bool autocomplete { get; set; }
            public string granularity { get; set; }
            public string query { get; set; }
            public bool trim_place { get; set; }
        }

        public class Result
        {
            public Place[] places { get; set; }
        }

        public class Place
        {
            public Attributes attributes { get; set; }
            public BoundingBox bounding_box { get; set; }
            public Place[] contained_within { get; set; }

            public string country { get; set; }
            public string country_code { get; set; }
            public string full_name { get; set; }
            public string id { get; set; }
            public string name { get; set; }
            public string place_type { get; set; }
            public string url { get; set; }
        }

        public class Attributes
        {
        }

        public class BoundingBox
        {
            public double[][] coordinates  { get; set; }
            public string type { get; set; }
        }
    }

and I receive the following exception. My system culture is Polish.

Input string was not in a correct format.

   at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.Double.Parse(String s, IFormatProvider provider)
   at Jil.Deserialize.Methods._ReadDoubleCharArray(TextReader reader, Char[]& buffer)
   at _DynamicMethod0(TextReader , Int32 )
   at _DynamicMethod7(TextReader , Int32 )
   at _DynamicMethod9(TextReader , Int32 )
   at Jil.JSON.Deserialize[T](TextReader reader, Options options)

DeserializeDynamic support string dump

Jil.DeserializeDynamic.JsonObject can't convert any json expression.
Would you add .ToString() return json string?
It's sometimes useful for debugging, adhoc query(with LINQPad), etc.

Support for DateTimeOffset serialization

Jil seems to crash when trying to serialize a DateTimeOffset:

for example:

var str = Jil.JSON.Serialize(new { TestDate = new DateTimeOffset() });

will crash with the following exception:

An exception of type Sigil.SigilVerificationException occurred in Sigil.dll but was not handled in user code Additional information: Call expected a System.TimeSpan* found System.TimeSpan

Is there a quick fix for this, would like to give Jil a spin on our rest api's :)

Deserialization: Label with name '_F' already exists

When trying to deserialize a very simple object JIL is throwing an error:

{"The type initializer for 'Jil.Deserialize.SetterLookup`1' threw an exception."} Label with name '_F' already exists

The class is: (Please note the case does matter)

public class SimpleObject
{
    public string FILMER { get; set; }
    public string FILLER1 { get; set; }
    public string fILLER2 { get; set; }
}

The deserialization code is:

JSON.Deserialize<SimpleObject>(JSON.Serialize(new SimpleObject() {}));

How get null value

example:
var a = { name:null, age:0}
OR
var a = { name:"egyed",age:0}
var data = JSON.DeserializeDynamic(a)

I need to get if the name has a value, but it is uncertain.

thks.

Branches

OK; hopefully I haven't screwed things up totally.

I have deleted my repository, and now I will fork your repository again. I will then use separate branches for the various functionality. I will then offer the individual branches up for pull requests. Hopefully this will make merging a lot easier.

Not sure how quickly I will be able to do this; here's hoping I know what I'm doing :-)

Deserialize without generic type-parameter but.. with.. Type parameter?

Good evening,

I was wondering whether there is any existing or a planned way to deserialize a string or stream into an object instance, without providing the target type via a type parameter, but via the "good old" Type parameter in the Json.Deserialize(..) signature, e.g.:

using(var input = new StringReader(myString))
{
var myTargetType = typeof(MyClass);
var result = JSON.Deserialize(input, myTargetType);
}

I know it doesn't exist atm and I would not want to use reflection to call your existing generic method via reflection to achieve that (ick: http://stackoverflow.com/questions/2107845/generics-in-c-using-type-of-a-variable-as-parameter) unless I had to. Right now I am attempting to plug Jil into NancyFx as a custom (De-)Serializer and their IBodySerializer signature only provides the target type as a plain Type parameter value, not as a type parameter.

Is there any chance that might be added to Jil as an alternative to the existing JSON.Deserialize method?

Cheers and thanks,
-J

Default options?

Would it be possible to override default options? Or, alternatively create an instance of the serializer with changed default options that I could stick into IoC container?

Deserializing Unicode escape sequences with lowercase hex values

In Jil/Deserialize/Methods.cs lines 343, 345, 347, and 349 prevent Unicode escape sequences with lower case hex values from deserializing correctly.

if (!((u >= '0' && u <= '9') || (u >= 'A' && u <= 'F') && (u >= 'a' && u <= 'f'))) throw new DeserializationException("Expected hex digit", reader);

should be

if (!((u >= '0' && u <= '9') || (u >= 'A' && u <= 'F') || (u >= 'a' && u <= 'f'))) throw new DeserializationException("Expected hex digit", reader);

Just wondering if you see the updated comments on the pull request?

Yeah, so do you? Anyway, a comment like "I'm pretty busy at the moment, but I'll take a look sometime in this month" or "I really need to you to make sure all unit tests are passing, plus adding new ones before I will even have a look" or something like that anyway would be nice. (I'm not [well I am a little, but I don't mean to, sorry!] nitpicking; just everyone in life likes some feedback!)

Anyway, I did have some results from one machine posted in the pull request; here is another set from a different machine:

Original

== Quick Graph 10/08/2014 8:23:47 PM ==
Running...
Serializing
===========
Single:
Type    Jil Static MS   Jil Static      Jil Dynamic MS  Jil Dynamic
User    0.0147          0.0147
Answer  0.0614          0.0614
Question        0.3737          0.382

Lists:
Type    Jil Static MS   Jil Static      Jil Dynamic MS  Jil Dynamic
User    0.0785          0.0793
Answer  0.2335          0.2319
Question        1.2674          1.25685

Dictionaries of strings to:
Type    Jil Static MS   Jil Static      Jil Dynamic MS  Jil Dynamic
User    0.4537          0.4511
Answer  1.5298          1.516
Question        5.41995         5.4782

Deserializing
=============
Single:
Type    Jil Static MS   Jil Static      Jil Dynamic MS  Jil Dynamic
User    0.0211          0.022
Answer  0.0956          0.0956
Question        0.6316          0.5878

Lists:
Type    Jil Static MS   Jil Static      Jil Dynamic MS  Jil Dynamic
User    0.1414          0.1395
Answer  0.4169          0.37515
Question        2.05185         1.8664

Dictionaries of strings to:
Type    Jil Static MS   Jil Static      Jil Dynamic MS  Jil Dynamic
User    0.7058          0.702
Answer  2.48095         2.3221
Question        9.16055         9.1796
== Finished ==

Pull Request version (obviously with caveats that are noted in pull request)

== Quick Graph 10/08/2014 8:21:36 PM ==
Running...
Serializing
===========
Single:
Type    Jil Static MS   Jil Static      Jil Dynamic MS  Jil Dynamic
User    0.0099          0.0099
Answer  0.0342          0.0339
Question        0.222           0.2223

Lists:
Type    Jil Static MS   Jil Static      Jil Dynamic MS  Jil Dynamic
User    0.0534          0.0527
Answer  0.1327          0.13065
Question        0.76355         0.7577

Dictionaries of strings to:
Type    Jil Static MS   Jil Static      Jil Dynamic MS  Jil Dynamic
User    0.2867          0.2863
Answer  0.9231          0.9351
Question        3.5404          3.51835

Deserializing
=============
Single:
Type    Jil Static MS   Jil Static      Jil Dynamic MS  Jil Dynamic
User    0.0159          0.0214
Answer  0.07            0.0934
Question        0.47            0.5842

Lists:
Type    Jil Static MS   Jil Static      Jil Dynamic MS  Jil Dynamic
User    0.10055         0.1369
Answer  0.3033          0.3636
Question        1.5375          1.82305

Dictionaries of strings to:
Type    Jil Static MS   Jil Static      Jil Dynamic MS  Jil Dynamic
User    0.506           0.6943
Answer  1.8355          2.28525
Question        7.42645         9.06395
== Finished ==

Here are the numbers expressed as % or original time:

Serializing
Single
User    67% 67%
Answer  56% 55%
Question    59% 58%

Lists
User    68% 66%
Answer  57% 56%
Question    60% 60%

Dictionaries 
User    63% 63%
Answer  60% 62%
Question    65% 64%

Deserializing
Single
User    75% 97%
Answer  73% 98%
Question    74% 99%

Lists
User    71% 98%
Answer  73% 97%
Question    75% 98%

Dictionaries 
User    72% 99%
Answer  74% 98%
Question    81% 99%

Deserialize: class empty but json has elements => throws

Looks like Jil throws a DeserializationException when encountering a key in a child which should be empty. Example:

using System;
using Jil;
using Newtonsoft.Json;

namespace JsonTests
{
    class Response
    {
        public int id { get; set; }
        public Foo foo { get; set; }
    }

    class Foo {  /* nothing here .. yet */ }

    class Program 
    {
        static void Main(string[] args)
        {
            const string jsonString = "{ \"id\" : 17, \"foo\" : { \"bar\" : 17} }";

            var resultJsonNet = JsonConvert.DeserializeObject<Response>(jsonString); /* ok */
            Console.WriteLine(resultJsonNet.id);

            var resultJil = JSON.Deserialize<Response>(jsonString); /* throws */
            Console.WriteLine(resultJil.id);
        }
    }
}

Can easily be mitigated by removing the empty Foo on the parent. But IMO worth making it a bit more robust if feasible without perf impact. It's a fairly typical dev workflow to incrementally build out data model, starting with empty classes. So those exceptions can hurt productivity a bit when it's not clear where they're coming from.

Generating deserializers performance concerns

For my application, I generate about 12 deserializers (and will generate many more in the future), by calling the Jil.JSON.Deserialize() with throw-away data. This takes about 45 seconds on my computer. By using performance monitor, I realized that only one CPU core is used, so I multithreaded the calls to JSON.Deserialize with throw-away data, with the hope that the deserializers would be generated in parallel. This made both CPU cores 100% used, but it takes the SAME (!!!) amount of time as before - 45 seconds to generate. Could you please tell me why does it behave like that? Also, 45 seconds is quite a lot of time and I fear that it will grow a lot higher as I use more deserializers. Would you please consider adding the option to save the deserializers into .dll so I don't have to generate them each time I run the app? But once the deserializers are generated for the first time, the performance is mind-blowing!

Local DateTime troubles

I'm a big fan of Jil but it seems its still not mature enough. DateTimes have become a pet peeve of mine. Almost all json serializers out there get DateTimes wrong without extensive configuration.

DateTime in .Net has a kind attached. Which can be one of three things Local, Utc or Unspecified. I believe Jil should behave differently for ISO8601 format.

Currently doing:

JSON.Serialize(DateTime.Now, new Options(dateFormat: DateTimeFormat.ISO8601))

returns:

 "2014-10-09T01:25:08.5660994Z"

This is wrong. Local or Unspecified DateTime should not be converted to UTC because makes it impossible to convert back to local time for the receiver unless the original timezone is known. The output I would expect would be:

"2014-10-09T012:25:08.5660994"

You can probably tell which time zone im in right now ;-)

For greater discussion please read about NodaTime concepts http://blog.nodatime.org/2011/08/what-wrong-with-datetime-anyway.html by Jon Skeet

DateTimeOffset loosing timezone information

Doing:

JSON.Serialize(DateTimeOffset.Now, new Options(dateFormat:DateTimeFormat.ISO8601))

returns

"2014-10-09T01:48:19.3430694Z"

I believe it should return

"2014-10-09T12:49:38.7355448+11:00"

Otherwise we're loosing the offset information. In other words the roundtrip test deserialize(serialize(o)) == o fails.

This is in the ISO specification, too.

Serializing custom dictionaries

If I create my own class inheriting from Dictionary and define custom fields/properties in that class, then even though I also mark those additional fields with [DataMember], Jil does seem to have an issue with parsing and always throws an exception. Basically, I want to be able to use my custom Dictionary class to parse without errors any of these two strings (Jil can't parse the first string):

{"intval":0, "strval":"some random msg"}
{"key1":{"property1":1,"property2":2,"property3":3},"key2":{"property1":4,"property2":5,"property3":6},"key3":{"property1":7,"property2":8,"property9":9}}

I have tried using class like this, but that doesn't work

public class MyDictionary : Dictionary<string, Poco>
{
            [DataMember(Name = "intval", IsRequired = false)]
            public int IntVal = 1;

            [DataMember(Name = "strval", IsRequired = false)]
            public string StrVal;
}

ReadEncodedStringWithBuffer more create a string instance

I'm glad you adopted the # 36 issue, but you just modify the \Deserialize\Methods.cs, no modification DeserializeDynamic\Methods.cs, is forgotten?

Today I would to know why in function:ReadEncodedStringWithBuffer

                    if (ix == CharBufferSize)
                    {
                        commonSb.Append(new string(buffer, 0, ix));
                        //commonSb.Append(buffer, 0, ix);
                        break;
                    }

Why is not my comment that code?Your code more create a string, I test it, there is a little bit better.

Similarly, the code has two Methods.

A few more optimizations

Hi Kevin,

I have a few more ideas that I would like to push across to you but just want to know what the right procedure to do this would be.

i.e. with the changes around using DigitPairs I just forked, modified and send a pull request, but this appears to not have been great, as I don't appear on the contributors list probably because of the way that you had to merge the code (OK, OK, my ego is hurt a little bit :-) ), so how should I proceed?

(Oh, and some of the optimizations that are included around 'uint's and the 32/64 bit appear to only really be beneficial on crappy cpus (I was doing it on an Aldi laptop (!) which had some form of i3 in it). I see that you haven't taken these changes. I think they should be taken as although they don't really make any difference on good cpus, I don't think they are particularly detrimental either -- these changes were done after the original pull request, but did appear later as a sync'd with github in the pull request page. So I'm not sure if you saw them? Sorry I haven't really used git very much at all...)

Also sorry that this is an "Issue" item, but I couldn't see if github projects has a general messages area? (nor could I find an email address, and I'm not into twitter...)

Thanks,
manofstick aka Paul...

ISO 8601 fractional seconds is too small

When deserializing we currently cutoff at 6. This is correct so far as the spec is concerned (ie. the spec lets you do whatever), but 7 has been observed in practice.

For future proofing, probably just want to support out to one Ticks resolution (100 nanoseconds).

I hate ISO8601.

Enhancement; fast double parsing

I'll put this in a pull request when we stabilise the code around deserialization.

The performance boost can be used when we are deserializing doubles that are 6 digits or less (which probably covers a reasonable number of cases in the wild...) This number was found through an exhaustive search, as in the code below. (obviously in jil we'd just hardcode 6 rather than trying to find the number!)

The fast parse is about 1/10 the time; and maybe in Jil it would be even faster (and create less garbage), as wouldn't need the extra step of converting the char[] into a string.

static int[] IntPowersOfTen = new[] {
    1,
    10, 
    100, 
    1000,
    10000,
    100000,
    1000000,
    10000000,
    100000000,
    1000000000,
};

static double[] PowersOfTen = IntPowersOfTen.Select(i => (double)i).ToArray();

static double FastDoubleParse(string s)
{
    var decimalPlacePosition = -1;
    var n = 0;
    for (var i=0; i < s.Length; ++i)
    {
        var c = s[i];
        if (c >= '0' && c <= '9')
            n = (n * 10) + (c - '0');
        else
            decimalPlacePosition = i;
    }
    var result = (double)n;
    if (decimalPlacePosition != -1)
        result /= PowersOfTen[s.Length - decimalPlacePosition - 1];
    return result;
}

static int FindNumberOfGoodDigits()
{
    var numberOfDigits = 0;
    try
    {
        while (true)
        {
            ++numberOfDigits;

            var maxNumber = 1M;
            for (var i = 0; i < numberOfDigits; ++i)
                maxNumber *= 10;

            for (var positionOfDecimalPlace = 0; positionOfDecimalPlace < numberOfDigits; ++positionOfDecimalPlace)
            {
                var divisor = 1M;
                for (var i = 0; i < positionOfDecimalPlace; ++i)
                    divisor *= 10M;

                for (var i=0M; i < maxNumber; ++i)
                {
                    var testNumber = i / divisor;

                    var numberString = testNumber.ToString();

                    var fastParse = FastDoubleParse(numberString);
                    var normalParse = double.Parse(numberString);
                    if (fastParse != normalParse)
                        throw new Exception(string.Format("Failed on \"{0}\" {1:R} != {2:R}", numberString, fastParse, normalParse));
                }
            }
        }
    }
    catch(Exception e)
    {
        Console.WriteLine(e.Message);
        Console.WriteLine();
        Console.WriteLine("But still all good for {0} digits", numberOfDigits-1);
    }

    return numberOfDigits-1;
}

static void SpeedCheck(int numberOfDigits)
{
    var r = new Random();

    var count = 100000;

    var maxNumber = 1;
    for (var i = 0; i < numberOfDigits; ++i)
        maxNumber *= 10;

    var numbers = new string[count];
    for (var i = 0; i < count; ++i)
    {
        // numbers have 6 digits or less
        var n = (double)r.Next(maxNumber) / IntPowersOfTen[r.Next(numberOfDigits)];
        numbers[i] = n.ToString();
    }

    // just eyeball some of the numbers to make sure this is sane
    Console.WriteLine("Sample of numbers:");
    for (var i = 0; i < 30; ++i)
        Console.WriteLine(numbers[i]);

    // check if parse OK
    for (var i = 0; i < numbers.Length; ++i)
    {
        if (double.Parse(numbers[i]) != FastDoubleParse(numbers[i]))
            throw new ApplicationException();
    }

    var checksum1 = 0.0;
    var checksum2 = 0.0;
    var intParseTime = 0L;
    var fastDoubleParseTime = 0L;

    for (var iterations = 0; iterations < 1000; ++iterations)
    {
        var sw1 = Stopwatch.StartNew();
        for (var i = 0; i < numbers.Length; ++i)
        {
            checksum1 += double.Parse(numbers[i]);
        }
        intParseTime += sw1.ElapsedMilliseconds;

        var sw2 = Stopwatch.StartNew();
        for (var i = 0; i < numbers.Length; ++i)
        {
            checksum2 += FastDoubleParse(numbers[i]);
        }
        fastDoubleParseTime += sw2.ElapsedMilliseconds;
    }

    if (checksum1 != checksum2)
        throw new ApplicationException();

    Console.WriteLine("int.Parse time = {0} vs Fast parse time = {1}", intParseTime, fastDoubleParseTime);

}

static void Main(string[] args)
{
    Console.WriteLine("Finding number of digits");
    var numberOfDigits = FindNumberOfGoodDigits();
    Console.WriteLine("Running test over random sample");
    SpeedCheck(numberOfDigits);
}

The output from running on my machine is:

Finding number of digits
Failed on "0.002877" 0.0028769999999999998 != 0.002877

But still all good for 6 digits

Running test over random sample

Sample of numbers:
85458.9
8138.14
37.7584
1.62695
9108.69
412.045
4144.88
2333.52
9.80292
284.819
302572
477792
6.8754
95851.4
4.66844
4046.56
6450.08
33670.9
7606.43
74220.8
0.38755
3362
352.762
883454
5771.85
95124
527.768
84.6037
752.962
32.2596

int.Parse time = 23657 vs Fast parse time = 2039
Press any key to continue . . .

Schema-less unified serializer initiative

Hello!
I believe serialization process can be split into 2 phases:

  1. Object-introspection stuff (analyze which properties to serialize, get property values etc)
  2. Formatting stuff (convert values to some format, write JSON string)

I propose to split those 2 phases via IJsonWriter interface:

public interface IJsonWriter {
    void WriteValue(byte value);
    void WriteValue(sbyte value);
    // etc
    void WriteValue(long value);
    void WriteValue(ulong value);
    void WriteValue(DateTime value);
    void WriteValue(TimeStamp value);
    void WriteValue(Guid value);
    void WriteValue(byte[] value);
    //etc
    void WriteValue(String value);
    void WriteNull();
    void WriteStartArray(int itemsCount);
    void WriteEndArray(int itemsCount);
    void WriteSeparator(); // ',' for arrays and maps
    void WriteStartMap(int itemsCount);
    void WriteEndMap(int itemsCount);
    void WriteMapKey(String key);
}

So providing different IJsonWriter implementations we can easy switch between real output format (BSON,MsgPack,Sereal,CBOR etc) having all other infrastructure untouched...

Same separation for reading/parsing. You need to

  1. Parse input stream by tokens and get primitive values
  2. Create objects and assign properties
public enum TokenType{
   ObjectStart,
   ObjectEnd,
   String,
   Number,
   Date,
   //etc
   Binary,
   ArrayStart,
   ArrayEnd
}
public interface IJsonReader{
     object CurrentTokenValue{get;}
     TokenType CurrentToken{get;}
     bool MoveNext();
}

what does You think?

Math.DivRem for speed?

This is purely an optimization question, not a bug.

A number of places like the ISO code use the pattern:

ix = val % 10;
val /= 10;

From what digging I could do, .Net doesn't optimize this nearly as well as one might hope. However, there's already a .Net built-in to do both operations at once, introduced in .Net 2.0:

http://msdn.microsoft.com/en-us/library/yda5c8dx.aspx

I've not tried it, but I'm curious if it would perform more optimally than the large number of % then / in ISO, int, etc code.

If not, as you likely know there are many optimizations for the combined operation out there, including several that are specific to narrow ranges of inputs, which ISO dates in particular exhibit:

http://embeddedgurus.com/stack-overflow/2011/02/efficient-c-tip-13-use-the-modulus-operator-with-caution/

Including some extremely specialized ones if you happen to be dividing by a power of two:

http://blog.teamleadnet.com/2012/07/faster-division-and-modulo-operation.html

Just some thoughts on possible remaining optimizations. Exciting library!

Cannot serialize enum values, and flag enums

We wish to serialize the property of a certain enum property of a class as numerical values, based on the definition below

[DataContract]
[Flags]
public enum RightsPropagationScope
{
    [EnumMember(Value = "0")]
    Unknown = 0,
    [EnumMember(Value = "1")]
    None = 1,
    [EnumMember(Value = "2")]
    Hierarchy = 2,
    [EnumMember(Value = "4")]
    Inside = 4,
    [EnumMember(Value = "8")]
    Outside = 8
}

But it seems Jil ignores EnumMemberAttribute and still serializes the string name.

Additionally, it appears when enum values in bitwise combination causes Jil to break,

Unexpected value for enumeration RightsPropagationScope
Sigil.Emit.DynamicAssembly
   at _DynamicMethod6(TextWriter , RightsPropagationScope , Int32 )
at _DynamicMethod0(TextWriter , Ticket , Int32 )
at Jil.JSON.ISO8601[T](T data, TextWriter output, Options options) in
c:\Users\Montrose\Dropbox\Jil\Jil\JSON.cs:line 515
at Jil.JSON.Serialize[T](T data, TextWriter output, Options options) in
c:\Users\Montrose\Dropbox\Jil\Jil\JSON.cs:line 106
at JsonPackager.SerializeCompress[TEntity](TEntity entity) in
d:\Projects\Development\JsonPackager.cs:line 48

Another Optimization: Loop Unrolling

CustomWriteInt would appear to benefit from loop unrolling. I'm unsure of how you test the CustomWriteInt methods, but I created a separate test harness of my own. Here's the time to write 1000000 ints, benchmarking the current CustomWriteInt method, and one with loop unrolling, on my machine. The odd numbers are current method, and evens are the loop-unrolled version:

Method 1: 0.3032052
Method 2: 0.2771878
Method 3: 0.3112356
Method 4: 0.2941975
Method 5: 0.3492319
Method 6: 0.2701928
Method 7: 0.3702835
Method 8: 0.2951981
Method 9: 0.3082033
Method 10: 0.2995115
Method 11: 0.3381807
Method 12: 0.2448614
Method 13: 0.3742492
Method 14: 0.2601764
Method 15: 0.3612422
Method 16: 0.2221459
Method 17: 0.3482335
Method 18: 0.2692908
Method 19: 0.31823
Method 20: 0.2611731

It appears to provide a significant savings.

Rather than paste a bunch of code here, here's a little repo to show you the code:

https://github.com/b9chris/CustomWriteDivRem/tree/master/DivRem

The methods are here:
https://github.com/b9chris/CustomWriteDivRem/blob/master/DivRem/SerializeMethods.cs

My simplified approximation of the existing CustomWriteInt is named CustomWriteInt_Standard. The unrolled version is named CustomWriteInt_Unrolled.

Note that the binary search at the beginning of the unroll is optimized for smaller ints - it presumes ints in the billions are rarer and so are OK to cope with more branching. This may or may not be true for your average JSON but I'd guess numbers below 100 are statistically much more common than those in the billions.

The design is based on the idea that CPUs will unroll loops if they don't depend on each other. The current implementation uses the output of one loop (copy) for the input of the next, which prevents the CPU from unrolling the loop. The approach used here reduces the number of branches (note that the while condition is itself a branch) and then provides the CPU with a long list of statements it can run simultaneously with no fear of mispredicting a branch. That, I suspect, is the source of the savings.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.