<div id="parent_2">Tatinek</div>
<script>
x = {
site_rule : "",
description : "",
tag_1 : "",
action_1 : "",
parent_1 : "",
tag_2 : "",
action_2 : "",
parent_2 : "",
tag_3 : "",
action_3 : "",
parent_3 : ""
}
y = {};
key = '';
o = null;
for (key in x)
{
o = document.getElementById(key);
y[key] = (o && (o.value || o.innerHTML || o.text)) || x[key];
}
alert(x.toSource())
alert(y.toSource())
</script>
Mi tvuj kod normalne funguje. Jen jsem z tama vyhodil ty slozite nazvy a doplnil o existenci objektu v html.