none
Valid JSON document fails to upload RRS feed

  • Question

  • I have the following valid JSON document (valid according to JSONlint.com and JSON.NET) but if I try to upload it I get an error:

    Exception: Microsoft.Azure.Documents.BadRequestException,
    message: {"Errors":["The request payload is invalid. Ensure to provide a valid request payload."]},
    request URI: rntbd://10.234.121.76:14600/apps/.........

    This happens in the call to client.CreateDocumentAsync. Sorry if the JSON document looks a bit random....

    {
        "FmYDBg": [
            "Fzzog{6<QuH>=YAeHMa9ua;\"LR/TXY*&.hJDEVsFM=92E^KLzR4@Q-WEGI4#[BM;_`.5o.`=t*LIsr~4h~uf6fsnZf.,3@R",
            [
                "$($xC3\"K7Nnmo7?XCgGmVV0",
                "a4i#sA<Cc,iQD;D",
                "M`M;9q4gpeh5*k=LnC?06@nt0m-\"g/ody=ij8qs~FYcv}YH=wfp$De]0_tj(G{ar:dU0b2@.kNSv_;FA5/*a9Y"
            ],
            ">zY@hWuTY=F-dY0URsU:~&y&}9:I"
        ],
        "_ts": {
            "Nk_VFk_K": "VwuooY#d0%Cb]2y${CZR/V2)hCRD;+!,YgH_)tcP5DU(Z2Dx$.G)mx!?VXh{gBkkdFR9J+<^zj+",
            "adgs_l": "G\"-BTHfnmqISsJ%tyU[;c+McZ;/OL2}}@p4mVqEb^7Vi1uS%P;hTE6;&T82~I%2KCV]c$T+ip{zvrDCEOH/T*IX9wk^`O4&bfk7tFPa>t/ERV_QqTMmb^w1</h",
            "AS_Ivln": [
                "?/Gcz(dfBZ*Ru",
                "%I9K=vy*UkvF;yxVJ^LMn(#.f:'6v{I4$6![H)){2E=;eEl8edz00#T,5=E<BTO&2R1n(Io_>Y)00_;16"
            ]
        },
        "Mj": {
            "apHgBsND": [
                "~#/l(]~[z;*mg;#pp4xhrX1=e",
                "Ft/P'^UGl8afB?(*h%Td#3~KT%kae[mhMyw*AS2U~_SIp+,hV}^uZtc!^@>BWUCw*'^d4bJ@:?Rdytu7(c",
                "w;Wsv&c)XO.gyw+vf;ETTeD_",
                "DOJp$Uala3MO8j?_gRbL5cU/13+a_s@>QwE!CI9Sfmw>0$luU7/{YFuB'KO}7aO8oQ/Z6LJ_*YF^7Zoj%TU:u3Lkcd*;'<)f+O8I^_PiMAsaa~VJvFwCUX!Me}X22Q5",
                "z<G47RfdLT<ZLkPXA_@_IZp=KD6d+H>VSm1^o$O[qyie&{&4itQ5qbT15UHS)cFeXNgyJ8J*y1WjRlsX(b>T:rFQ&a[&x>ro'dVu7JIA-7VQUJx"
            ],
            "qSRJeS": [
                "$J'1LCYHqN#.2A^**k)],y3vFNnVgh:qlq4?HjJt\"mt-dEiWcMrd*t&H%_J/ocBiXO=_X&CZ1S.0f\"s",
                "$T*:{W;XLH(`Ke]=kC@TX?Ik%Cqw0B1TI*YY^s(;'cl",
                "-EOh.<@@W7$kYzZF)+j^qG2VGt;^)ZU[hR7.3o=Gl]=};Ni;k~xEb&QT@'25c,\".B3cgT~@W{3VAU[!;l?W"
            ],
            "qj": "bBJ0MhEp.[_pKbOY/1Symp?`F0&dO8*l]@frs6k6NGD$CNWj_/m!+!B=",
            "JzFw": [
                "Pz8>xFt#_=6{IL;BYRP(hNCBu]XBW",
                "%mL}n1nC^;.a3V?'x_",
                "0zUmc.U2H9\"iG`o`,Y6~Kp83jNZ7u>z1uQCG^z-pvM<-a[&dHz,`71T*R3c#M`VMXq[:L9h_+#F/u,2v6WO>?_<T.&[]wv4W:XC0a3%ZsyarJUOUa8",
                "A_M,wJ'3'sQS{0i)*;uc:]41_4jRtI[OL}wEkG!$0]$?8XE_L4=i!8?L9_KSzQXZDcg?!5_DE#sby4'dNYfQX6{#}-WN>jFHGf(6QF.^rX4.#/me5Hf"
            ]
        },
        "vebCjyg": "nHvy-*shn~i~Mz?b[a]+R*!e#,zdm@?uu",
        "ciCL": "'.$6.p/9cWBQwe6T5r&}Kp<Z~}Gbv-Sov_5Ud9gP/R"
    }

    Monday, August 25, 2014 2:40 PM

Answers

  • The problem with this particular piece of JSON is the use of _ts as an attribute name.
    We use _ts, along with a number of other _attributes, as internal system properties and they are only settable internally. This particular one is for timestamp when the doc was created.

    If you remove _ts, or rename it, as I did in a test application the doc is inserted correctly.

    I'd like to understand a little more about the use case here.
    What is generating this JSON? It looks like it has been obfusticated by something. Is this true? Is this a process  you wrote? Is it possible to control the attribute names and not use _anything as a name?

    If you cannot control this, and this is valid JSON from a system (and not random test data you generated) then we need to rethink how we represent internal properties like this.

    Regardless, I have logged an issue to fix the error message so that it is more meaningful and won't leave you guessing.

    Tuesday, August 26, 2014 6:00 PM

All replies

  • Thank you for posting this. We will use this JSON and investigate the problem.
    That is indeed interesting looking JSON to say the least :)

    Tuesday, August 26, 2014 5:20 PM
  • The problem with this particular piece of JSON is the use of _ts as an attribute name.
    We use _ts, along with a number of other _attributes, as internal system properties and they are only settable internally. This particular one is for timestamp when the doc was created.

    If you remove _ts, or rename it, as I did in a test application the doc is inserted correctly.

    I'd like to understand a little more about the use case here.
    What is generating this JSON? It looks like it has been obfusticated by something. Is this true? Is this a process  you wrote? Is it possible to control the attribute names and not use _anything as a name?

    If you cannot control this, and this is valid JSON from a system (and not random test data you generated) then we need to rethink how we represent internal properties like this.

    Regardless, I have logged an issue to fix the error message so that it is more meaningful and won't leave you guessing.

    Tuesday, August 26, 2014 6:00 PM
  • It is actually random JSON... So the good news is I can change the property name to anything I want :)

    But a better error message would be helpful. In time I'll probably not be the only one using properties starting with underscores. Isn't there a list of internal property names you could document? Since (valid) documents are rejected because of this it's not exactly an implementation detail but rather a 'feature'.

    Tuesday, August 26, 2014 7:38 PM