Question: I would like to get information like below,

```
SiteCollection
--- RootSite
------Site1
------------Site1.1
--------------------List1
------------Site1.2
------------Site1.3
------Site2
------Site3
------Site4

```

I want to get this information as a JSON, I know I can get it as a csv using following PS code,

```
$allwebapps = Get-SPWebApplication | select url foreach ($webapp in $allwebapps) {
    Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, ID, ParentWebID | Export-CSV “C:\Users\A\Desktop\Structure.csv”
-NoTypeInformation }

```

I am not sure if there's anything out there already or I can change this script

Answer: 
I used for the similar task:

1. Get Lookup Id from query string

`<ParameterBinding Name="RootDocId" Location="QueryString(RootDocID)" DefaultValue=""/>`

2. Replace on NewForm.aspx

`<SharePoint:FormField runat="server" id="ff5{$Pos}" ControlMode="New" FieldName="RootDocument" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@RootDocument')}"/>`

with

`<asp:TextBox runat="server" id="ff5{$Pos}" text="{$RootDocId}" value="{$RootDocId}" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@RootDocument')}" />`

[Building custom forms](https://social.technet.microsoft.com/wiki/contents/articles/23955.sharepoint-2013-building-custom-forms.aspx)

UPD:
To use custom form:

1. Open NewForm.aspx in Designer
2. Place cursor just above `<WebPartPages:ListFormWebPart>` tag - the default form
3. From "Insert" tab on ribbon use "New Form" button to place it on page
4. Drop the default form from page.
In SharePointDesigner we created 3 forms realted with the list (New, Edit,Display).
These forms are the default ones.

Now we can open, edit and create items.