---
title: Interpreting the JSON format of a crash report
framework: xcode
role: article
role_heading: Article
path: xcode/interpreting-the-json-format-of-a-crash-report
---

# Interpreting the JSON format of a crash report

Understand the structure and properties of the objects the system includes in the JSON of a crash report.

## Overview

Overview Starting with iOS 15 and macOS 12, apps that generate crash reports store the data as JSON in files with an .ips extension. Tools for viewing these files, such as Console, translate the JSON to make it easier to read and interpret. The translated content uses field names the article Examining the fields in a crash report describes. Use the following information to understand the structure of the JSON the system uses for these crash reports and how the data maps to the field names found in the translated content. Typical JSON parsers expect a single JSON object in the body of the file. The IPS file for a crash report contains two JSON objects: an object containing IPS metadata about the report incident and an object containing the crash report data. When parsing the file, extract the JSON for the metadata object from the first line. If the bug_type property of the metadata object is 309, the log type for crash reports, you can extract the JSON for the crash report data from the remainder of the text. The following example reads the contents of a crash report into a dictionary:     do {         let content = try String(contentsOfFile: filePath, encoding: String.Encoding.utf8)

/// Read the first line, the metadata object, into a dictionary.         let metadataRange = content.lineRange(for: ..<content.startIndex)         let metadataJSON = content[metadataRange].data(using: .utf8)         let metadata = try JSONSerialization.jsonObject(with: metadataJSON!) as! Dictionary<String, Any>

/// Check the `bug_type` property of the metadata for type `309`, the log type for crash reports.         let logType = "\(metadata["bug_type"] ?? "(unknown)")"         guard logType == "309" else {             // Handle the error.                     fatalError("Log type \(logType) is not a crash report.")         }

/// Read the remainder of the file, the crash report object, into a dictionary.         let reportRange = content.lineRange(for: metadataRange.upperBound..<content.endIndex)         let reportJSON = content[reportRange].data(using: .utf8)         let report = try JSONSerialization.jsonObject(with: reportJSON!) as! Dictionary<String, Any>

return report     } catch {         // Handle the error.         fatalError("*** An error occurred while reading the crash report: \(error.localizedDescription) ***")     } The crash report data is made up of additional objects pertaining to OS version, bundle, store, exception, termination, threads, frames, and binary images. The properties of all these objects are outlined below. IPS metadata The IPS metadata object contains the following properties:  |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |  Crash report The crash report object can contain the following properties:  |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |  Platforms The numeric values for platform include: 1 for macOS 2 for iOS (includes iOS apps running under macOS on Apple silicon) 3 for tvOS 4 for watchOS 6 for Mac Catalyst 7 for iOS Simulator 8 for tvOS Simulator 9 for watchOS Simulator OS version A report includes OS version information in an object that can contain the following properties:  |  |   |  |   |  |   |  |   |  |  Bundle info A report includes bundle information in an object with the following properties:  |  |   |  |   |  |   |  |  Store info A report includes store information in an object with the following properties:  |  |   |  |   |  |   |  |  Exception A report includes exception information in an object with the following properties:  |  |   |  |   |  |   |  |   |  |   |  |  For more information, see Exception information. note: This exception information doesn’t refer to language exceptions thrown by an API or language features in Objective-C or C++. Crash reports record language exception information separately. Termination A report includes termination information in an object that can contain the following properties:  |  |   |  |   |  |   |  |   |  |   |  |   |  |  For details on how to use this information, see Exception information. JSON stores numeric values as decimal numbers. The value the system stores in the code property is intended to be viewed in its hexadecimal form; see Convert numeric values to hexadecimal numbers. Threads A report includes thread information in objects that can contain the following properties:  |  |   |  |   |  |   |  |   |  |   |  |  For details on how to use this information, see Backtraces and Thread state. JSON contains numbers for memory addresses in frame and thread state objects as decimal digits. To view the numbers contained in these fields in their more common hexadecimal form, see Convert numeric values to hexadecimal numbers. Frames A report includes information about frames in objects with the following properties:  |  |   |  |   |  |   |  |   |  |  For details on how to use this information, see Backtraces. JSON contains numbers for the memory locations and offsets as decimal digits. To convert the numbers contained in these fields to their more common hexadecimal form, see Convert numeric values to hexadecimal numbers. Binary images A report includes information about binary images loaded in the process at the time of termination in objects with the following properties:  |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |  For details on how to use this information, see Binary images. Convert numeric values to hexadecimal numbers JSON stores numeric values as decimal numbers. Many of these numeric values, such as error codes and memory addresses, appear in a translated report as hexadecimal numbers to make them easier to interpret. You can use the following to print a hexadecimal representation of the numbers from the decimal representation found in the JSON. import Foundation

let decimal = 2343432205

print(String(format: "0x%lx", decimal)) // Prints "0x8badf00d".

## See Also

### Crash reports

- [Adding identifiable symbol names to a crash report](xcode/adding-identifiable-symbol-names-to-a-crash-report.md)
- [Identifying the cause of common crashes](xcode/identifying-the-cause-of-common-crashes.md)
- [Analyzing a crash report](xcode/analyzing-a-crash-report.md)
- [Examining the fields in a crash report](xcode/examining-the-fields-in-a-crash-report.md)
- [Understanding the exception types in a crash report](xcode/understanding-the-exception-types-in-a-crash-report.md)
