JSFiddle - React, Tailwind, and code Playground

HTML

<a-entity id="1" position='0 0 0' sound='src: url; on: click, volume: 2.0'>ccc</a-entity>

JavaScript

var element = document.getElementById('1');
    
    var data = {
        src: 'url',
        on: 'click',
        volume: '2.0'     
    };
    
    element.setAttribute('sound', JSON.stringify(data));      
    var newData = JSON.parse(element.getAttribute('sound'));
    newData.volume = 4;
    element.setAttribute('sound', JSON.stringify(newData));
    
    console.log(element);