Document Tree as JSOn

Is there any way to return partial or entire CMS tree as json in the same order it appear in JSON.

e.g
- A
- B
- B1
- B2
- B3
- C
- C1
- C2
- A1
....

I know how to return a json for a particular document types. What I need is t return entire subtree as json in a way that A will contain B and B1 subpart of json will contains B1, B2, B3. C will be at same level as B is and so on.

Recent Answers

Well thats the approach I would like to take. The only doubt have is, if REST service will preserve the order of tree as a json.

I tried accessing this via rest service /rest/cms.country?format=json and got this error

IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used.

Do you have any idea about this? I am sure we wont be able to delete IntegratedWindowsAuthentication from our authentication mode.

You haven't correctly setup or configured the RESTful service in Kentico. Take a look at the link I sent initially and it has the info in there to properly configure authentication. If you set the ?OrderBy=NodeLevel,NodeOrder,NodeName your order should be the same as in the content tree. My mistake in the previous post for stating the WHERE clause

Yes, I reached out to our network team to figure out this. For some reason, the formatting of Node which I wanted didn't appear after I saved my question.

I want this structure

A

B

B1

B2

B3

C

C1

C2

C3

So if this is the structure of my tree, is there any api that can return my tree in json where A contains B & C at top level. And, B contains B1, B2, B3 in a Nested json. Similarly B & C will be nested in A