Skip to main content
elaborated
Source Link
Chirishman
  • 389
  • 1
  • 6

PowerShell, 17 bytes

Slightly unclear on how strict the 'no input' thing is, if it's just no user input or of system input is also disallowed. While my best answer isn't shorter than the other PowerShell answer I think it is novel.

ps|ConvertTo-Json

Gets running processes (default return is an object) and converts that object to a json object. Several other two and three letter aliases commands work.

Sample output omitted because it's 34115 lines long and trying to redact my username and computername was a pain.

gl|ConvertTo-Json

Gets your current filesystem location (as an object) and converts that object to a json

gci|ConvertTo-Json

Gets the files in your current path (as an object) and converts that object to a json

You can also take things like inherent type definitions (which are part of the language itself) and pipe them into the conversion function.

[xml]|ConvertTo-Json

Gets the definition of the xml datatype and converts that object to a json

[int]|ConvertTo-Json

Gets the definition of the 32bit integer datatype and converts that object to a json

PowerShell, 17 bytes

Slightly unclear on how strict the 'no input' thing is, if it's just no user input or of system input is also disallowed. While my best answer isn't shorter than the other PowerShell answer I think it is novel.

ps|ConvertTo-Json

Gets running processes (default return is an object) and converts to a json object. Several other two and three letter aliases work.

gl|ConvertTo-Json
gci|ConvertTo-Json

You can also take things like inherent type definitions (which are part of the language itself) and pipe them into the conversion function.

[xml]|ConvertTo-Json
[int]|ConvertTo-Json

PowerShell, 17 bytes

Slightly unclear on how strict the 'no input' thing is, if it's just no user input or of system input is also disallowed. While my best answer isn't shorter than the other PowerShell answer I think it is novel.

ps|ConvertTo-Json

Gets running processes (default return is an object) and converts that object to a json. Several other two and three letter aliases commands work.

Sample output omitted because it's 34115 lines long and trying to redact my username and computername was a pain.

gl|ConvertTo-Json

Gets your current filesystem location (as an object) and converts that object to a json

gci|ConvertTo-Json

Gets the files in your current path (as an object) and converts that object to a json

You can also take things like inherent type definitions (which are part of the language itself) and pipe them into the conversion function.

[xml]|ConvertTo-Json

Gets the definition of the xml datatype and converts that object to a json

[int]|ConvertTo-Json

Gets the definition of the 32bit integer datatype and converts that object to a json

Source Link
Chirishman
  • 389
  • 1
  • 6

PowerShell, 17 bytes

Slightly unclear on how strict the 'no input' thing is, if it's just no user input or of system input is also disallowed. While my best answer isn't shorter than the other PowerShell answer I think it is novel.

ps|ConvertTo-Json

Gets running processes (default return is an object) and converts to a json object. Several other two and three letter aliases work.

gl|ConvertTo-Json
gci|ConvertTo-Json

You can also take things like inherent type definitions (which are part of the language itself) and pipe them into the conversion function.

[xml]|ConvertTo-Json
[int]|ConvertTo-Json