原数组:image.png

    新数组:
    image.png

    1. //原数组
    2. let obj = [{
    3. datetime: "2021-09-09 14:56:36",
    4. area: "上海",
    5. detail: "二月二月砚田街h",
    6. image: "",
    7. shareimageurl: "https://jdy-crm.oss-cn- beijing.aliyuncs.com/kd_pro/1536230697407890389/20210831/3008633655172026.jpg",
    8. content: "二月砚田街和er'he'r'h",
    9. channelId: 5031,
    10. modelId: 1421,
    11. modelName: "活动列表模型",
    12. titleColor: "#333333",
    13. titleIsBold: true,
    14. title: "bhrthrt",
    15. type: 5,
    16. shortTitle: "rher"
    17. }]
    18. //改变数组结构 map方法
    19. let arr = obj.map((item)=>{
    20. return {
    21. json: {
    22. datetime: "2021-09-09 14:56:36",
    23. area: "上海",
    24. detail: "二月二月砚田街h",
    25. image: "",
    26. shareimageurl: "https://jdy-crm.oss-cn-beijing.aliyuncs.com/kd_pro/1536230697407890389/20210831/3008633655172026.jpg",
    27. content: "二月砚田街和er'he'r'h"
    28. },
    29. channelId: 5031,
    30. modelId: 1421,
    31. modelName: "活动列表模型",
    32. title: {
    33. titleColor: "#333333",
    34. titleIsBold: true,
    35. title: "bhrthrt"
    36. },
    37. type: 5,
    38. shortTitle: "rher"
    39. }
    40. })
    41. console.log(arr);