# How to rotate an EditBone? is it possible

I have a dict of 2d data and I want to generate bones (skeleton), assuming z = 0 for translation and rotation is across z axis in given dict.

data = {"bones":[{"name":"root"},
{"name":"COM","parent":"root","length":35.18,"x":-128.09,"y":160.22},
{"name":"torso","parent":"COM","length":102.78,"x":127.78,"y":-116.67,"rotation":90},
{"name":"armL","parent":"torso","length":76.14,"x":62.96,"y":-39.81,"rotation":-103.29},
{"name":"armR","parent":"torso","length":92.75,"x":68.52,"y":32.4,"rotation":104.14}]}


here is my blender script to iterate on the dict. I can create bones. currently placing new bone on top of each other(almost). what I can handle is, initial head position directly , on x and y coords placing tail position directly via length but

HOW to apply rotation? any ideas

Sample code for current progress..

import json,os,sys
from mathutils import Matrix
from mathutils import Vector
import bpy

def createBaseArmature():
ob = bpy.context.object
return ob
def createBones(amt,bonesData):
print (str(len(bonesData)) + " bones found")
for each in bonesData:
bone = amt.edit_bones.new(each['name'])
if 'parent' in each:
bone.parent = amt.edit_bones[each['parent']]
rot = Matrix.Translation((0,0,0))
bone.tail = rot * Vector ((0,0,each['length'])) + bone.head
else:

While you can adjust the head/tail/roll directly, EditBone's have a helper function for this: EditBone.transform, which I think is the most direct answer to your question, just pass a rotation matrix to it.