Theme Builder Error: Unexpected token ‘<', " <fo"… is not valid JSON

This topic has 15 replies, 4 voices, and was last updated 8 months, 2 weeks ago ago by Andrew Mitchell

  • Avatar: YT
    YT
    Participant
    June 5, 2024 at 19:22

    Hi there,

    I just updated xstore to v9.3.11 but now I can’t access the Elementor Theme Builder. It gives the error: “Error: Unexpected token ‘<', "
    https://www.8theme.com/topic/error-unexpected-token-is-not-valid-json-in-theme-builder/
    Tried the code but it doesn't fix the Theme Builder error.

    Any ideas on how to fix this?

    Thanks.

    Files is visible for topic creator and
    support staff only.
    14 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    June 6, 2024 at 07:45

    Hi @YT,

    Could you please provide temporary wp-admin and FTP access?

    To grant WP-Admin access, please proceed to create a new user account with an administrator role through your WordPress Dashboard. Once the account is established, you may securely transmit the username and password to us via the Private Content section designated for this purpose.

    For FTP access, we require the following details: FTP host, FTP username, FTP password, FTP port, and FTP encryption type. If you need assistance in creating these credentials, please reach out to your hosting provider who will guide you through the process.

    Best Regards,
    8Theme’s Team

    Avatar: YT
    YT
    Participant
    June 6, 2024 at 10:57

    Hi Luca,

    Can’t give you access. As specified in the ticket I’m developing on localhost, which is good because it rules out the server side issues from the solution I tried from this ticket: https://www.8theme.com/topic/error-unexpected-token-is-not-valid-json-in-theme-builder/

    Think I found the problem though.

    The JSON error appears after creating/editing an elementor loop item. Its expecting JSON but instead is getting HTML so it doesn’t parse as valid JSON. If I delete the loop item, theme builder works again. But then I can’t create/edit loop items so it’s not functional.

    Sent you the php stacktrace before but don’t know how it got removed from the ticket. I’ll send it again as an attachment here.

    Thanks.

    Files is visible for topic creator and
    support staff only.
    Avatar: Justin
    Luca Rossi
    Support staff
    June 6, 2024 at 11:15

    Dear @YT,

    We are currently in need of the specific page template available at your website for testing purposes. Could you kindly export it for us?

    https://elementor.com/help/template-library/

    We would greatly appreciate your assistance with this matter.

    Best regards,
    The 8Theme Team

    Avatar: YT
    YT
    Participant
    June 6, 2024 at 17:39

    Sure, no sweat Luca. Thanks for your help.

    Ok I’ve attached 2 files to replicate the issue:
    1. elementor-LoopGridPage.json
    2. elementor-LoopItem.json

    The LoopGridPage references the LoopItem to draw the grid.

    The use case is that I’m building a ‘product collections’ page. So the query in LoopGrid iterates all the terms for a product attribute (Artwork Theme) and then displays it according to the design in the LoopItem.

    The LoopItem is just an Image box element that has its title, description and URL values set using the Archive’s dynamic tags. The LoopGrid outputs 1 Image Box for each attribute term (Artwork Theme) and the user can click through on any one to go to the shop page and see a collection of products with the selected attribute filter applied. Nice, simple, UX and if I use the same LoopItem with more than 1 LoopGrids that iterate different product attributes then the implementation is efficient also.

    You’ll see the whole thing works fine in these templates, except that Theme Builder konks out with the JSON error after an Elementor LoopItem is created. Then Theme Builder throws the JSON error and, if I switch to table view, then I can’t open the LoopItem in Elementor Editor because it throws the php exception I sent you earlier and is unusable.

    I did some testing to help isolate the error and this is what I found:

    1. I tried the same setup for other Loop Items (like Post & Product) and the Loop Grid worked fine. Theme Builder and Elementor Editor also didn’t throw errors. They seem to only go bonkers when the LoopItem type is set to ‘Product Taxonomy’.

    2. If I trash the LoopItem template then the LoopGrid still works and theme Builder starts working again. Theme Builder only throws the JSON error when the LoopItem is an active template (not in the bin). Wierd, yes.

    3. I can successfully edit the LoopItem by clicking ‘Edit Template’ in the LoopGrid even if it’s in the bin. In this case, the LoopGrid thinks there’s no LoopItem template selected but I never exit the Elementor Editor so it doesn’t have a chance to crash. I guess, technically, the LoopItem still ‘exists’ in the bin so the LoopGrid can still read it. But of course that breaks Theme Builder and I can’t edit instances of different shop pages because the Editor is crashing so chicken and egg situation here.

    Phew I talked your head off here. Hope all this will save you time. It may just be an edge case.

    Thanks.
    BTW, I can only upload 1 file at time so the LoopGridPage.json is attached to this reply and make another reply with the LoopItem attached.

    Avatar: YT
    YT
    Participant
    June 6, 2024 at 17:39

    Here’s the LoopItem.json file attached

    Avatar: Justin
    Luca Rossi
    Support staff
    June 7, 2024 at 04:48

    Hi @YT,

    It seems you forgot to upload the JSON files or unsuccessfully to upload them.

    Could you please try uploading to Google Drive instead?

    Thank you!

    Avatar: YT
    YT
    Participant
    June 7, 2024 at 10:10

    Hi, links shared in private area. Thanks

    Please contact administrator
    for this information.
    Avatar: Justin
    Luca Rossi
    Support staff
    June 7, 2024 at 12:22

    Dear @YT,

    We are pleased to inform you that we have successfully imported your template files, and they are functioning correctly on our local site.

    You can view the operational status here: [https://www.awesomescreenshot.com/video/28426040?key=588bfd7a895f19fdb7e4a5af60235763](https://www.awesomescreenshot.com/video/28426040?key=588bfd7a895f19fdb7e4a5af60235763)

    Could you please confirm if there are any third-party plugins currently active? We recommend deactivating all third-party plugins temporarily to see if it resolves any issues.

    If the problem persists, it is possible that the issue may be related to the server. We kindly ask you to check this as well.

    Thank you for your cooperation.

    Best Regards,
    The 8Theme Team

    Avatar: YT
    YT
    Participant
    June 7, 2024 at 13:20

    Hi Luca,

    There are only 4 plugins active:
    1. Elementor
    2. Pro Elements
    3. Woocommerce
    4. Xstore core

    I need the loop query to iterate over attributes but I tried categories, tags and brands like in your video. Same problem. Theme Builder breaks with the same json error.

    The query definitely works because the Loop Grid generates the data but theme Builder remains broken no matter which taxonomy I use.

    If the issue is related to the server, what do you want me to check?
    I already tried this code: https://www.8theme.com/topic/error-unexpected-token-is-not-valid-json-in-theme-builder/

    Thanks again.

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    June 7, 2024 at 16:25

    Dear @YT,

    We suggest that you activate the “Hello Elementor” theme while ensuring that the XStore theme is not active. Please ensure that only the following plugins are active:
    1. Elementor
    2. Pro Elements
    3. WooCommerce

    Subsequently, please verify the functionality using the “Hello Elementor” as the default theme.

    It is important to note that the loop item functionality is provided by the Pro Elements plugin, which is developed independently from our XStore theme. Therefore, its functionality should not be affected by our theme and the issues you had could show with the default theme also.

    Additionally, there may be a possibility that your PHP or other server requirements do not meet or exceed the necessary specifications. We recommend using PHP version no higher than 8.2.

    Best regards,
    Jack Richardson
    The 8Theme Team

    Avatar: YT
    YT
    Participant
    June 8, 2024 at 14:43

    Hey Jack,

    Ok, deactivated xstore core plugin and switched to helloelementor theme. Here’s the results:

    1. Elementor theme builder still gives the JSON error on loading
    2. On the upside, Elementor Editor doesn’t throw the PHP exception anymore when editing the loop item
    3. PHP version was 8.2.13. Changing to 8.1.26 doesn’t change anything for any of the points above.

    Based on this, your call on Pro Elements may be right for point 1. The PHP stack exception that comes when opening Elementor editor with a loopitem (after xstore is enabled again) may have something to do with xstore. Either way, as far as I can see the error comes from app.min.js when its loading templates into theme builder and gets html instead of json.

    So just for kicks I also:
    1. Tried switched elementor to safe mode. Didn’t fix it.
    2. Regenerated the template data and css. Didn’t help.

    I looked up pro elements but they dont provide support so do you have a relationship with them to query the issue please?
    Maybe its a known issue.

    Thanks for your time on this man.

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    June 10, 2024 at 07:55

    Dear @YT,

    I hope this message finds you well. We have investigated the issue you reported and discovered that it appears to be specifically related to the local websites you are currently utilizing. For further details, please refer to the following discussion on their community forum: https://community.localwp.com/t/local-elementor-pro-loop-grid-acf-undefined-array-key-product-query-post-type/38683/3.

    In such case we can suggest you to disable debug log and continue working on or create the staging web-site and continue the development process there.

    Should you require additional assistance, we encourage you to submit a request directly on their forum to receive targeted support.

    Thank you for your attention to this matter.

    Kind regards,
    Jack Richardson
    8Theme’s Team

    Avatar: YT
    YT
    Participant
    June 13, 2024 at 16:25

    Hi there,

    Ok cool. I’ll look at it again once I move to a live host. If that solves it I’ll update you guys. Meanwhile I’ll resolve this ticket.

    Thanks again for your efforts. Appreciated.

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    June 13, 2024 at 16:26

    Dear YT,

    As we continue our mission to exceed expectations, your insights become increasingly valuable. Could we, with all due respect, request your thoughtful feedback by giving our theme a deserved 5-star rating on ThemeForest?

    Click here to share your valuable perspective: https://themeforest.net/downloads

    Your time and trust are highly appreciated!

    Best Regards,
    The 8Theme Team

  • Viewing 15 results - 1 through 15 (of 15 total)

The issue related to '‘Theme Builder Error: Unexpected token ‘<', " <fo"… is not valid JSON’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.