[{"data":1,"prerenderedAt":368},["ShallowReactive",2],{"project-3582565":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":35,"aspects":36,"strip":41,"post_text":43,"what":44,"said":54,"maker_in_thread":177,"shape":190,"grid":193,"attempts":329,"same_week":330,"maker_shows":42,"maker_hidden":360,"reader_version":361,"card":362},"3582565","JSON parser","Very low footprint JSON parser in portable ANSI C","title","Show HN: Very low footprint JSON parser in portable ANSI C ","https:\u002F\u002Fgithub.com\u002Fudp\u002Fjson-parser","github.com","udp",1329072428,2012,111,54,187,1677,12,"notable","languages","json parser library","library",[24,25,26,27],"json parser","ansi c","c library","portable c","roasted",-0.552,{"positive":31,"neutral":32,"mixed":33,"critical":34},1,5,0,15,21,{"execution":37,"design":39,"performance":40},{"positive":31,"critical":38},10,{"positive":33,"critical":32},{"positive":33,"critical":33},[33,33,33,31,33,33,33,33,31,31,33,31,33,31,31,42,42,33,33,31,33,33,33,33,42,33,31,33,33,33,33,31,31,33,31,33,31,42,42,31],3,null,{"problem":43,"audience":43,"pricing":43,"motivation":43,"time_to_build":43,"stack":45,"openness":52,"stage":53,"team_size":53},[46],{"value":47,"source":48,"evidence":49},"ANSI C","maker",[50],{"id":51},"post","open_source","unknown",{"praise":55,"objections":68,"requests":102,"questions":117,"alternatives":136},[56],{"value":57,"source":58,"evidence":59},"Lightweight and easy to use, comparable to other C JSON parsers","commenter",[60,64],{"id":61,"by":62,"text":63},"3583310","mappu","What are you doing with json.h:121 in _json_value::&operator[](const char* index) when your key doesn't exist? Still, very nice. Comparable to jsonxx which i've been using up…",{"id":65,"by":66,"text":67},"3582799","roschdal","I like using Jansson: http:\u002F\u002Fwww.digip.org\u002Fjansson\u002F",[69,80,91],{"value":70,"source":58,"evidence":71},"Integer and float parsing uses strtol\u002Fstrtod in an unsafe way",[72,76],{"id":73,"by":74,"text":75},"3583308","schlecht","``` const json_char *cur_line_begin, *i; ... top->u.dbl = strtod (i, (json_char **) &i); top->u.integer = strtol (i, (json_char **) &i, 10); ``` Ick",{"id":77,"by":78,"text":79},"3585642","adobriyan","``` case JSON_INTEGER: obj = QOBJECT(qint_from_int(strtoll(token_get_value(token), NULL, 10))); ``` Why is it so hard to parse integer from string correctly?",{"value":81,"source":58,"evidence":82},"Portability concerns with hex lookup tables and character set assumptions",[83,87],{"id":84,"by":85,"text":86},"3582903","feralchimp","Is JSON guaranteed to be ASCII? To clarify: Any \"lookup table\" that maps hex values to assumed character values is a portability red flag. When using them, it's polite to add…",{"id":88,"by":89,"text":90},"3583589","pantaloons","Neither the execution nor source character set (of C) is guaranteed to be ASCII though. This makes the general parsing as well as lines like \"if (c >= 'A' && c \u003C= 'F')\"…",{"value":92,"source":58,"evidence":93},"No tests provided",[94,98],{"id":95,"by":96,"text":97},"3583668","robocop","Where are the tests?",{"id":99,"by":100,"text":101},"3584771","reidrac","Oh, thanks. I was starting to feel weird because nobody was saying anything about the lack of tests. HN may or may not work as a code review platform, but I don't think I would…",[103,110],{"value":104,"source":58,"evidence":105},"Handle input lengths over 2^31 and unsigned length types",[106],{"id":107,"by":108,"text":109},"3583281","tptacek","What happens when the input length is longer than 2^31? You used an \"int\" for the length (also, why ever use a signed value for length?) --- even on LP64, that counter wraps at…",{"value":111,"source":58,"evidence":112},"Handle UTF-16 surrogate pairs and truncated \\u escapes",[113],{"id":114,"by":115,"text":116},"3583143","justincormack","\\u is utf16 so you should be able to append two characters to get something in the extended unicode set outside ucs16. You dont seem to handle this; not sure how many parsers do.…",[118,132],{"value":119,"source":58,"evidence":120},"Why not use isdigit or enums",[121,125,128],{"id":122,"by":123,"text":124},"3582762","avar","Any reason you roll your own numeric() instead of using isdigit()? It's in C89.",{"id":126,"by":74,"text":127},"3583264","Why are you doing \"#define numeric(b) ((b) >= '0' && (b) \u003C= '9')\" instead of say isdigit(3) ?",{"id":129,"by":130,"text":131},"3582779","andrewcooke","why are the flag values not enums (and why is 4 missing?)? is using a lookup table for decoding hex really faster than the (minimal) logic (what if it causes cache misses)? do…",{"value":133,"source":58,"evidence":134},"How missing keys are handled in operator[]",[135],{"id":61,"by":62,"text":63},[137,148,156,163,170],{"value":138,"source":58,"evidence":139},"YAJL",[140,144],{"id":141,"by":142,"text":143},"3583257","haberman","What's wrong with YAJL?",{"id":145,"by":146,"text":147},"3584842","lflux","Nothing, YAJL got a lot of things very right. We use it in our C daemons for a bunch of things. Not having to unpack the whole JSON into memory is pretty handy.",{"value":149,"source":58,"evidence":150},"Jansson",[151,152],{"id":65,"by":66,"text":67},{"id":153,"by":154,"text":155},"3588835","scumola","+1 for Jansson here too. Lightweight and works really well.",{"value":157,"source":58,"evidence":158},"cJSON",[159],{"id":160,"by":161,"text":162},"3582875","tcas","I've used cJSON (http:\u002F\u002Fsourceforge.net\u002Fprojects\u002Fcjson\u002F) in the past, which worked very well for what I needed (simple 1 file JSON parser for config files). Maybe I'll give this…",{"value":164,"source":58,"evidence":165},"jsmn",[166],{"id":167,"by":168,"text":169},"3582739","m_eiman","Here's another minimalist alternative: https:\u002F\u002Fbitbucket.org\u002Fzserge\u002Fjsmn\u002Fwiki\u002FHome I've used it and think it's pretty neat. One of these days I'll get around to releasing the…",{"value":171,"source":58,"evidence":172},"ultrajson",[173],{"id":174,"by":175,"text":176},"3583190","mape","Another alternative, https:\u002F\u002Fgithub.com\u002Fesnme\u002Fultrajson \"Ultra fast JSON decoder and encoder written in C with Python bindings\" From the people that built the Battlefield 3 web…",{"comments":178,"answered":179,"key":180},8,4,[181,184,187],{"id":182,"text":183},"3583416","Added some protection against that, thanks.",{"id":185,"text":186},"3583049","Well spotted! Fixed, thanks.",{"id":188,"text":189},"3582926","I'm assuming UTF-8, so the characters I'm looking for should match up fine (\\u escape sequences are also converted to UTF-8 for output).",{"commenters":191,"max_depth":179,"maker_replies":178,"first_comment_mins":15,"lifespan_hours":192},41,35,[194,198,199,202,203,205,207,211,214,217,220,221,223,226,227,228,232,233,234,235,237,241,246,247,250,251,253,256,259,261,264,265,268,270,273,277,280,283,286,290,293,296,298,301,302,304,307,311,315,318,321,324,326,328],[195,33,33,196,197,33],"3582855","other\u002Fneutral\u002Fnone","aliguori",[141,33,33,196,142,33],[200,33,33,196,201,33],"3584120","mikehuffman",[145,33,33,196,146,33],[77,33,31,204,78,33],"project\u002Fcritical\u002Fexecution",[174,31,33,206,175,33],"other\u002Fneutral\u002Fperformance",[208,209,33,196,210,33],"3584386",2,"spullara",[212,209,33,196,213,33],"3584834","alexchamberlain",[215,209,33,196,216,33],"3585271","zoul",[218,209,33,196,219,33],"3586738","jsaunders",[107,42,31,204,108,33],[182,42,33,222,11,31],"maker\u002Fneutral\u002Fexecution",[224,179,31,204,225,33],"3583007","halayli",[185,179,33,222,11,31],[84,32,31,204,85,33],[229,32,42,230,231,33],"3582922","project\u002Fneutral\u002Fexecution","michael_miller",[188,32,33,222,11,31],[114,32,31,204,115,33],[88,32,31,204,89,33],[236,32,33,222,11,31],"3583603",[238,239,42,240,146,33],"3584817",6,"project\u002Fneutral\u002Fdesign",[242,243,42,244,245,33],"3583169",7,"project\u002Fneutral\u002Fperformance","chops",[65,178,33,196,66,33],[248,178,33,196,249,33],"3583658","rmk",[153,178,33,196,154,33],[73,252,31,204,74,33],9,[254,38,33,196,255,33],"3582752","peter_l_downs",[257,38,33,196,258,33],"3582968","rmgraham",[160,260,33,196,161,33],11,[262,260,33,206,263,33],"3583079","mikepurvis",[167,18,33,196,168,33],[266,18,33,196,267,33],"3585148","fmardini",[122,269,42,230,123,33],13,[271,269,33,272,11,31],"3582768","maker\u002Fneutral\u002Fperformance",[274,269,33,275,276,33],"3583178","commenter\u002Fneutral\u002Fperformance","shtylman",[129,278,31,279,130,33],14,"project\u002Fcritical\u002Fdesign",[281,278,33,282,11,31],"3582812","maker\u002Fneutral\u002Fdesign",[284,278,33,285,130,33],"3582828","commenter\u002Fneutral\u002Fdesign",[287,278,33,288,289,33],"3583068","commenter\u002Fneutral\u002Fexecution","parenthesis",[291,278,33,288,292,33],"3583163","nknight",[294,278,33,285,295,33],"3583234","pjscott",[297,278,33,282,11,31],"3583253",[299,278,31,279,300,33],"3583297","cpeterso",[61,34,31,279,62,33],[303,34,33,282,11,31],"3583314",[305,34,31,279,306,33],"3583442","mahmud",[308,309,33,196,310,33],"3582788",16,"krakensden",[312,309,33,313,314,33],"3586325","other\u002Fcritical\u002Fnone","lmm",[316,317,31,279,300,33],"3583301",17,[319,320,31,204,74,33],"3583279",18,[322,320,32,323,295,33],"3583400","maker\u002Fpositive\u002Fexecution",[126,325,42,240,74,33],19,[95,327,31,204,96,33],20,[99,327,31,204,100,33],[],[331,336,341,346,351,356],{"id":332,"name":333,"points":334,"category":335},"3589963","Hackershelf",532,"learning_science",{"id":337,"name":338,"points":339,"category":340},"3572755","Pixelapse",409,"productivity",{"id":342,"name":343,"points":344,"category":345},"3594540","Bootswatch",407,"dev_tools",{"id":347,"name":348,"points":349,"category":350},"3579207","WrapBootstrap",354,"web_saas",{"id":352,"name":353,"points":354,"category":355},"3592295","RAVN",74,"consumer_social",{"id":357,"name":358,"points":359,"category":340},"3585419","Coworking Weekly",57,false,"v2",{"id":363,"name":5,"line":6,"ai":360,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":364,"top":18,"kw":365,"maker":11,"domain":10,"tier":19,"attempts":33,"strip":366,"url":9,"mix":367,"praise":57,"objection":70,"sub":21},3582565,-0.55,[24,25,26,27],"0001000011010113300100003010000110101331",[31,32,33,34],1793990878746]