CloneableJSON Documentation
Overview
Reference
Actual Data Structure from Pole Measurements
{
"high_accuracy": true,
"pole_information": {
"height": 35.5,
"lean_angle": 2.1,
"location": {
"latitude": 40.7128,
"longitude": -74.0060,
"altitude": 10.5
}
},
"attachments": [
{
"id": "550e8400-e29b-41d4-a716-446655440001",
"type": "attachment",
"classification": "Transformer",
"inventoryClass": {
"name": "Transformer",
"subcategories": [
{
"name": "Size",
"value": "25 kVA"
},
{
"name": "Type",
"value": "Single Phase"
}
]
},
"owner": "Utility Company A",
"images": [
{
"imageId": "550e8400-e29b-41d4-a716-446655440002",
"point": {
"x": 256.5,
"y": 384.2
}
}
],
"related_task_id": "task_123",
"height": 28.5,
"distanceFromPoleTop": 7.0,
"relatedSpans": ["550e8400-e29b-41d4-a716-446655440010"],
"relatedGuys": ["550e8400-e29b-41d4-a716-446655440020"],
"heading": 180
}
],
"images": [
{
"id": "550e8400-e29b-41d4-a716-446655440003",
"type": "pole",
"image": "[CloneableImage UUID reference]",
"referenceLine": {
"bottom": {
"id": "550e8400-e29b-41d4-a716-446655440004",
"pixelCoordinates": {
"x": 320.0,
"y": 800.0
},
"worldCoordinates": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
},
"top": {
"id": "550e8400-e29b-41d4-a716-446655440005",
"pixelCoordinates": {
"x": 320.0,
"y": 100.0
},
"worldCoordinates": {
"x": 0.0,
"y": 0.0,
"z": 35.5
}
}
},
"scalingData": {
"pixelArray": [
{
"id": "550e8400-e29b-41d4-a716-446655440006",
"pixelCoordinates": {
"x": 200.5,
"y": 450.2
},
"worldCoordinates": {
"x": -2.1,
"y": 0.8,
"z": 15.5
}
}
]
},
"cameraTilt": 5.2,
"predictedCameraTilt": 4.8,
"wasAutoCaptured": false,
"wasCapturedInSafeZone": true,
"stickDistance": 12.5,
"stickHeight": 8.0
}
]
}Understanding CloneableJSON
Three Ways to Access Values
1. Safe Optional Access (Returns nil if wrong type)
2. Throwing Access (Throws descriptive errors)
3. Direct Enum Pattern Matching (Original method)
Available Accessor Properties and Methods
Optional Properties (return nil if wrong type):
Throwing Methods (throw JSONError if wrong type):
Helper Properties:
JSONError Types
Working with Attachments
Extracting Attachment Data
Extracting Inventory Classifications
Working with Images
Extracting and Saving Images
Alternative: Using AnyCloneableData Extension
Working with Scaling Data
Working with CloneableImage Directly
Advanced Image Operations
Simple JSON String Export
Schema Support
Getting All File Data Values
Error Handling Best Practices
Best Practices
Quick Reference
Your Original Problem - Now Solved!
Last updated

