import bpy import json from bpy import context vec3 = lambda vec: {"x": vec.x, "y": vec.y, "z": vec.z} bone_head = lambda ctx, bone: vec3(ctx.matrix_world.translation + bone.head_local) bone_tail = lambda ctx, bone: vec3(ctx.matrix_world.translation + bone.tail_local) bone = lambda ctx, bone: {"head": bone_head(ctx, bone), "tail": bone_tail(ctx, bone)} bone_name = lambda name: name.replace('.', '_').replace('-', '_').lower() arm_context = bpy.context.object arm_data = arm_context.data out = {bone_name(b.name) : bone(arm_context, b) for b in arm_data.bones} print('\n\n\n\n') print(json.dumps(out))