Solved How to get data from a txt file

Discussion in 'Plugin Development' started by Deaaad, Aug 15, 2023.

Thread Status:
Not open for further replies.
  1. Offline

    Deaaad

    I have a txt file with models from pack textures. I only need to get the name of the item and the associated model date. I don't want to use separate classes and enums. Suppose the file is not sorted by rows.

    {"predicate":{"custom_model_data":1},"model":"new:cosmetics/models/punching_bag/default"},
    {"predicate":{"custom_model_data":2},"model":"new:cosmetics/models/punching_bag/large"},
     
  2. Online

    timtower Administrator Administrator Moderator

    @Deaaad and what have you tried so far?
     
  3. Offline

    Deaaad

    in general, nothing, I need any options, I just need to simplify the process for the future, because there are plans to make a lot of models
     
  4. Online

    timtower Administrator Administrator Moderator

    We are not gonna write the code for you.
    The content of the file is JSON, so you need a parser for that.
    Then a normal file reading operation to read the file and give it to the JSON parser
     
  5. Offline

    Deaaad

    okay, thank. I know what to do now. I just didnt know i can just read json file
     
  6. Online

    timtower Administrator Administrator Moderator

    If you can read it using a text editor you can read it with code
     
  7. Offline

    f1oating

    @timtower but how could i parse json or yaml file by tags ?
     
  8. Online

    timtower Administrator Administrator Moderator

    Those are 2 very different formats, take a pick, make your own thread
     
Thread Status:
Not open for further replies.

Share This Page