Post

4 followers Follow
0
Avatar

Avoid pretty print in JSON result?

Is there an option to disable pretty print of the JSON result from the API?

I'm already using GZIP compression, so I'm not trying to save bandwidth, just memory when reading the JSON. It would save about 33% memory and I wouldn't have to switch to a better json decoder just yet.

Audun Rundberg Answered

Please sign in to leave a comment.

6 comments

0
Avatar

No way to currently do this. I'll open an internal CR on this.

Eyal Post 0 votes
Comment actions Permalink
0
Avatar

OK, thanks. So now I'm looking at different ways to keep the JSON that Clarizen returns as small as possible.

I'm now trying to add a projectConstraint so that my resourceManagementQuery only returns projects with a work load > 0, but I'm getting the error «Can not convert value '0' to type 'Duration' (Field name: 'Work')»

This is the JSON for the request that currently fails:

 

{
   "resourceEntitiesIds":[
      "/User/c22e86c8-93d9-4b64-8eb1-b43bc13a0887"
   ],
   "definition":{
      "setting":{
         "fields":[
            {
               "typeName":"User",
               "fieldNames":[
                  "Email"
               ]
            }
         ],
         "sortingType":"Alfabet",
         "workOrRemainingEffort":"Work",
         "loadOrAvailability":"Load",
         "hoursView":true,
         "reportingPeriod":"Daily"
      },
      "globalFilters":{
         "timeFilter":{
            "from":"2016-02-29T00:00:00",
            "to":"2016-03-06T00:00:00"
         },
         "wantedStates":[
            "Active",
            "Draft"
         ],
         "projectConstraint":{
            "leftExpression":{
               "fieldName":"Work"
            },
            "operator":"GreaterThan",
            "rightExpression":{
               "value":"0"
            }
         }
      }
   }
}
Audun Rundberg 0 votes
Comment actions Permalink
0
Avatar

If what' you're trying to do is save on memory then why not simply minify the JSON on your side?

 

Eyal Post 0 votes
Comment actions Permalink
0
Avatar

Hi Audun,

Try 0d or 0h (not just '0') for the work value. You need to specify the unit for duration/effort constants.

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink
0
Avatar

Eyal: My main goal is to save memory, but reducing the amount of data sent helps. :-)

Ophir: Thanks! Works like a charm.

Audun Rundberg 0 votes
Comment actions Permalink