Convert file with animations to 3D matrix format

Hi all, for a project, I was asked by a dev which formats save animations. I thought about .blend indeed and FBX as well.
But is there a way to convert them easily in your own matrix 3D format ?

Any help would be appreciated :

In what format is your data in? Is it already in Blender? What target format do you aim for?
Is it about Armature animations, or plain object animations?

In this case, he thinks about using the json format to store the information of the 3d martrix. The idea would be to be able to convert the existing chosen format with its animations in our own 3d matrix format. As exemple; we could create an animation inside blender and make it compatible thanks a tool we could create.
The animations would be simple with no armatures.

here’s a really rough way to do it:

import bpy

def mat4_to_json(mat):
    return ",
".join('      [%f, %f, %f, %f]' % vec[:] for vec in mat)

def anim_to_json(filepath, ob):
    with open(filepath, 'w') as file:
        frame_orig = sce.frame_current
        for frame in range(sce.frame_start, sce.frame_end + 1):
            file.write("    [
    ]" % mat4_to_json(ob.matrix_world))
            if frame != sce.frame_end:
        sce.frame_current = frame_orig

sce = bpy.context.scene
ob = bpy.context.object

anim_to_json("anim.json", ob)

It would be much more elegant if you used classes or json.dumps, but above code should actually be more memory efficient.

CodemanxX, Really, thank you !!!