import json
import bpy

# Get all cameras
scene = bpy.data.scenes[0]
cameras = []
for cam_obj in bpy.data.cameras:
    user_map = bpy.data.user_map(subset={cam_obj}, value_types={'OBJECT'})
    for data_obj in user_map[cam_obj]:
        cam = {'name': data_obj.name,
               'cam_name': cam_obj.name,
               'cam_name_full': cam_obj.name_full,
               'lens': cam_obj.lens,
               'lens_unit': cam_obj.lens_unit,
               'sensor_height': cam_obj.sensor_height,
               'sensor_width': cam_obj.sensor_width,
               'is_active': scene.camera.name_full == cam_obj.name_full}
        cameras.append(cam)

data = {'cameras':  cameras,
        'engine': scene.render.engine,
        'frame_start': scene.frame_start,
        'frame_end': scene.frame_end,
        'resolution_x': scene.render.resolution_x,
        'resolution_y': scene.render.resolution_y,
        'resolution_percentage': scene.render.resolution_percentage,
        'fps': scene.render.fps}

data_string = json.dumps(data)
print("SCENE_DATA:" + data_string)
