PowerShell Genie

PowerShell JSON log contains truncated nested data

Incident 1 min read Troubleshooting walkthrough

Documentation: Microsoft Learn

Work the problem

The nested value became text

Fictional case: A log parses as JSON, but a required nested object is represented as a type-name string. The serializer used its default depth.

Which change addresses this?

Reasoning notebook

Record the evidence that supports your answer and the check you would run next. Your notes stay in this browser — nothing is uploaded.

Why it happens

ConvertTo-Json limits serialization depth. Nested objects beyond the selected depth are reduced instead of being fully represented.

Check this first

1PS> $object | ConvertTo-Json; $object | ConvertTo-Json -Depth 10

What to look for

The data shape must be included during serialization. Then parse it back and inspect the required nested value.

Working through it

  1. Compare the default serialization with a deliberately higher Depth value.
  2. Choose a depth that covers the schema you actually intend to log rather than using an extreme value blindly.
  3. Project large or sensitive nested objects to the fields the log needs before serialization.
  4. Parse one emitted line with ConvertFrom-Json and inspect the expected nested property.

Avoiding it next time

Verify the repair: Parse an emitted record and assert the nested property value and type expected by the consumer.

Primary documentation

ConvertTo-Json reference

Work through the incident

Check nested JSON output

A report serializes successfully but nested fields are missing.

Review the lesson

Genie guidePowerShell JSON log contains truncated nested data

Start with the symptom, then inspect the checks and evidence. These are investigation steps; more than one cause may fit.