Read and write to JSON

Discussion in 'Off Topic' started by blogsit3, Mar 13, 2017.

  1. blogsit3

    blogsit3 New Member

    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    I have an angular 2 project, how can I read and write to a JSON file on my server?

    I can do what I want within my code itself bit I don't want to have to change my code, recompile and upload my website every time.

    Any help?
     
  2. essellar

    essellar Community Advocate Community Support

    Messages:
    3,295
    Likes Received:
    227
    Trophy Points:
    63
    Not as such, no. Well, you can read JSON, of course, but directly writing to a file from the "front end" isn't possible and uploading JSON for a PHP page to write to file is going to run into 403 errors. You can upload a similarly-structured bit of text that can be transformed to JSON server-side; key/value stuff doesn't have to look like executable/eval code.

    That said, what is "compile" in this context? JSON doesn't need to be compiled (except insofar as a JavaScript engine may decide to JIT it before running it). You're editing text and uploading it. Why is that harder in cPanel's file manager than it is on your own site's front end?
     

Share This Page