JSON decode of Unicode escape sequence: cannot handle more than 4 hex digits?

Hm, looks like splitting the character into utf-16 codepoints and escaping those works, but I'm not sure whether that should work everywhere or it's just Foundation:

import Foundation

let anEmoji: Character = "\u{1F468}\u{1F3FB}\u{200D}\u{2764}\u{FE0F}\u{200D}\u{1F468}\u{1F3FB}"
let str = "\"" + anEmoji.utf16.map { "\\u" + String($0, radix: 16) }.joined() + "\""

let decoder = JSONDecoder()
if let data = str.data(using: .utf8), let result = try? decoder.decode(String.self, from: data) {
    print(result)   // works
} else {
    print("No dice!")
}