locked
RESJSON file format specification RRS feed

  • Question

  • Hi all,

    I'm working on a translation project built on .net 4.0 that should now also support RESJSON resource file parsing. I'm having problems writing a parser for it because I couldn't find online any clear documentation regarding the file format.

    Also the parser should support the language plural rules described www.unicode.org/cldr/charts/supplemental/language_plural_rules.html

    Could you be so kind to point me into the right direction?

    Thanks,

    Victor S.

    Thursday, December 27, 2012 11:56 AM

All replies

  • Hi

    I am not sure what your exact need is. Hope this will help as a starter.  Here is how to stringify the JSON format file and parse that back to array items.

    .....getFileAsync("datafile1.txt").then(function (gotFile) { return Windows.Storage.FileIO.readTextAsync(gotFile) }) .done(function (d) { if ((d !== "") && (d !== null) && (d !== undefined)) { dataArray = obj.concat(JSON.parse(d)); }});. . . . . . if (dataArray.length !== 0) { mystr = JSON.stringify(dataArray);

    .

    .

    Windows.Storage.FileIO.writeTextAsync(sampleFile, mystr).done(function () { });

    -Karthika


    karthika

    Thursday, December 27, 2012 3:36 PM
  • Hi Karthika,

    Thank you for your answer, but what I am looking for is the file format specification. From my understanding .resjson is a hybrid .json format which may contain specific items which are not covered by the JSON specification. For instance I have found some .resjson sample files generated by VS2012 which contain comments like C++/C# style, which are not actually supported by the JSON format.

    Example:
    {
    // this is a single line comment

    "first_key" : "this is a string value",

    /* this is a
    multi-line
    comment */

    "second_key" : "this is the second string value"
    }

    The sample above would not be parsed by an ordinary JSON parser without some cleansing action to remove the comments before the actual processing.

    I'm wondering if there are any other such things that are not covered by the JSON format. So this is the reason I'm asking for a full file format specification.

    Also another issue not clear to me is if the RESJSON format supports the language plural rules (described here, www.unicode.org/cldr/charts/supplemental/language_plural_rules.html), and if it does, how these are formatted.


    Any help is really appreciated.

    Thanks,
    VictorS.

    • Edited by VictorS08 Friday, December 28, 2012 11:02 AM
    Friday, December 28, 2012 11:00 AM