Solution 1 :

Seems your converter is working in the opposite way it should. You would typically convert a value to JSON from an attribute and stringify it when setting it to the attribute since attribute values must be of type string.

const jsonStringConverter = {
    toAttribute(val) {
        // convert the value to string so it can be used as an attribute value
        return JSON.stringify(val);
    fromAttribute(str) {
        // convert the attribute value to a JS object to use it as a property
        return JSON.parse(str);

In fact that is the default converter LitElement uses for Object types so you should not need it.

Problem :

I am creating a custom element that takes the value of a JSON as an input to a select tag. I keep getting the syntax error above. The element is meant to take the input of the value and also the value obtained from the ajax call as the value for the value of the mwc-list-item tag.
I have attached a picture of the error below.

<clinical-status value="resolved"></clinical-status>

import {LitElement, html} from 'lit-element';
import '@material/mwc-textfield/mwc-textfield.js';
import '@material/mwc-select';
import '@material/mwc-list/mwc-list-item';
import '@material/mwc-formfield';
import '@polymer/iron-ajax/iron-ajax.js';

class ClinicalStatus extends LitElement {
    static get properties() {
        return {
            typeField: {type: String},
            url: {type: String},
            value: {type: Array}
    constructor() {
        this.typeField = 'true';
        this.value = {};

    updated() {

        this.shadowRoot.getElementById('ajax').addEventListener('iron-ajax-response', function (e) {
            var allergy =;
            if (e.detail.response.clinicalStatus !== undefined) {
                allergy.value = e.detail.response.clinicalStatus;
            else {

    render() {
        return html`
    <div id="allergyDiv">
   <mwc-formfield label ="CLINICAL STATUS:" alignEnd>
   ${this.typeField !== 'false' ? html`
   <mwc-select outlined class="typeField" value="${this.value}" @change="${e => this.value.clinicalStatus =}">
        <mwc-list-item value="active">Active</mwc-list-item>
        <mwc-list-item value="inactive">Inactive</mwc-list-item>
        <mwc-list-item value="resolved">Resolved</mwc-list-item>
    </mwc-select>` : ''}
     <iron-ajax id="ajax" bubbles auto handle-as="json" .url="${this.url}"></iron-ajax>


I defined the function below as a converter but I get error

clinical-status.js:98 Uncaught TypeError: Cannot create property ‘clinicalStatus’ on string ‘resolved’

const jsonStringConverter = {
    toAttribute(val) {
        return JSON.parse(val);
    fromAttribute(str) {
        return JSON.stringify(str);

How can I fix it?
enter image description here