---
title: assumesTopLevelDictionary
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/jsondecoder/assumestopleveldictionary
---

# assumesTopLevelDictionary

Specifies that decoding assumes the top level of the JSON data is a dictionary, even if it doesn’t begin and end with braces.

## Declaration

```swift
var assumesTopLevelDictionary: Bool { get set }
```

## Discussion

Discussion This is an extension to JSON5 that’s not part of the specification. AttributedString uses this option, along with allowsJSON5, to support the use of JSON5 inside Markdown strings that use multiple custom attributes. Using assumesTopLevelDictionary allows for the following syntax inside the parentheses of the custom attribute markup: This is a [Markdown](https://commonmark.org) string with a ^[custom attribute](factor: 10, other: true). Without assumesTopLevelDictionary, the markup would have to use explicit enclosing braces to declare the contents of the parentheses to be a dictionary: This is a [Markdown](https://commonmark.org) string with a ^[custom attribute]({factor: 10, other: true}). When you use braces, you must use matched pairs. This means that with assumesTopLevelDictionary set, the syntax ({…}) and (…) are both legal, but ({…) and (…}) are not.

## See Also

### Customizing Decoding

- [keyDecodingStrategy](foundation/jsondecoder/keydecodingstrategy-swift.property.md)
- [JSONDecoder.KeyDecodingStrategy](foundation/jsondecoder/keydecodingstrategy-swift.enum.md)
- [userInfo](foundation/jsondecoder/userinfo.md)
- [allowsJSON5](foundation/jsondecoder/allowsjson5.md)
